[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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user