Removing unnecessary element detach logic from Canvas DocumentNodeElement
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 8 Dec 2013 21:34:40 +0000 (22:34 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 15 Dec 2013 21:32:49 +0000 (22:32 +0100)
All of this logic is now handled properly at the wlxml.js level and
Canvas reacts accordingly through document events handling.

src/editor/modules/documentCanvas/canvas/documentElement.js

index 1c0719f..210c492 100644 (file)
@@ -195,19 +195,6 @@ $.extend(DocumentNodeElement.prototype, {
         return this.dom().children('[document-element-content]');
     },
     detach: function() {
         return this.dom().children('[document-element-content]');
     },
     detach: function() {
-        var parent = this.parent();
-        if(!parent)
-            return;
-
-        var parentChildren = parent.children(),
-            myIdx = parent.childIndex(this);
-
-        if(myIdx > 0 && myIdx < parentChildren.length) {
-            if((parentChildren[myIdx-1] instanceof DocumentTextElement) && (parentChildren[myIdx+1] instanceof DocumentTextElement)) {
-                parentChildren[myIdx-1].appendText(parentChildren[myIdx+1].getText());
-                parentChildren[myIdx+1].detach();
-            }
-        }
         this.dom().detach();
         this.canvas = null;
         return this;
         this.dom().detach();
         this.canvas = null;
         return this;