X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/7c4c5ee807a9700c1b26e91f0d1720e3c6fd9ec3..5ecc2f0247f9d648dc1795b9633a3c37cc86bb52:/src/editor/modules/documentCanvas/canvas/documentElement.js diff --git a/src/editor/modules/documentCanvas/canvas/documentElement.js b/src/editor/modules/documentCanvas/canvas/documentElement.js index 99a12f5..d40ca9b 100644 --- a/src/editor/modules/documentCanvas/canvas/documentElement.js +++ b/src/editor/modules/documentCanvas/canvas/documentElement.js @@ -151,13 +151,26 @@ $.extend(DocumentNodeElement.prototype, { _container: function() { return this.dom.children('[document-element-content]'); }, - detach: function() { - var parents = this.parents(); - this.dom.detach(); - if(parents[0]) { - parents[0].refreshPath(); + detach: function(isChild) { + var parents; + + if(this.gutterGroup) { + this.gutterGroup.remove(); + } + if(_.isFunction(this.children)) { + this.children().forEach(function(child) { + child.detach(true); + }); } - return this; + + if(!isChild) { + parents = this.parents(); + this.dom.detach(); + if(parents[0]) { + parents[0].refreshPath(); + } + } + return this; }, before: function(params) { return manipulate(this, params, 'before'); @@ -214,8 +227,10 @@ $.extend(DocumentTextElement.prototype, { .text(this.wlxmlNode.getText() || utils.unicode.ZWS); return dom; }, - detach: function() { - this.dom.detach(); + detach: function(isChild) { + if(!isChild) { + this.dom.detach(); + } return this; }, setText: function(text) {