X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5c398fccc970cf74b857ea5c191b325564f9893f..ccac057cea9d0852c33a970d12856ea39cd75291:/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;