summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-10-23 17:12:57 +0200
committerqsm-odoo <qsm@odoo.com>2017-10-24 10:50:18 +0200
commit7bd8f9a5b2cde69cb68c71998973a1fe38c97e02 (patch)
treea79423117a86eeb88b5306ac33a277ec3095bcb9 /addons/web_editor/static/src/js
parent33d20a224164cd83f09018addcf02496f22bced2 (diff)
[FIX] web_editor: replacing selected text in a hierarchy on Firefox
When following these steps on Firefox: - Select all text in a bold link (triple click) - Type some text The typed text did not replace the selected text but was instead put at the front of it.
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/summernote.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js
index 51dd3df97ed..bdd365ff93f 100644
--- a/addons/web_editor/static/src/js/summernote.js
+++ b/addons/web_editor/static/src/js/summernote.js
@@ -550,6 +550,13 @@ dom.removeBetween = function (sc, so, ec, eo, towrite) {
so = 0;
eo = 1;
}
+
+ var parentNode = sc && sc.parentNode;
+ if (parentNode && sc.tagName === 'BR') {
+ sc = parentNode;
+ ec = parentNode;
+ }
+
return {
sc: sc,
so: so,
@@ -1164,9 +1171,9 @@ $.summernote.pluginEvents.visible = function (event, editor, layoutInfo) {
if (!r) return;
if (!r.isCollapsed()) {
- if (dom.isCell(dom.node(r.sc)) || dom.isCell(dom.node(r.ec))) {
+ if ((dom.isCell(dom.node(r.sc)) || dom.isCell(dom.node(r.ec))) && dom.node(r.sc) !== dom.node(r.ec)) {
remove_table_content(r);
- r = range.create(r.ec, 0).select();
+ r = range.create(r.ec, 0);
} else {
r = r.deleteContents(true);
}