X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5c398fccc970cf74b857ea5c191b325564f9893f..84f4d7abd8501301c22d9be0565a392d33fd9cd9:/src/smartxml/core.js diff --git a/src/smartxml/core.js b/src/smartxml/core.js index ba612b4..a2d39a6 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -77,8 +77,9 @@ var documentNodeTransformations = { wrapWith: function(node) { var insertion = this.getNodeInsertion(node); - if(this.parent()) { - this.before(insertion.ofNode); + + if(this.parent() || this.isRoot()) { + this.replaceWith(insertion.ofNode); } insertion.ofNode.append(this); return insertion.ofNode;