X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/cef69fff5322bdc7766d7063809694f6ee0e9e47..a6983a6a33c76bc7ae107c604ba73c3571aed7b8:/src/smartxml/core.js diff --git a/src/smartxml/core.js b/src/smartxml/core.js index b40e9c3..f907a20 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -474,7 +474,7 @@ var documentTransformations = { return insertion.ofNode; }, deleteText: function(params) { - var ptr, next, toDetach, middle, text; + var ptr, next, nextNext, toDetach, middle, text; if(params.from.node.sameNode(params.to.node)) { ptr = params.from.node; @@ -502,7 +502,11 @@ var documentTransformations = { } else { toDetach = next; next = next.next(); - toDetach.detach(); + nextNext = next ? next.next() : null; + toDetach.detach({normalizeStrategy: (next && next.sameNode(params.to.node)) ? 'merge' : 'detach-right'}); + if(next && !next.isInDocument()) { + next = nextNext; + } } } else { ptr = ptr.parent();