editor: canvas fix - check for the case when mutation concerns already detached text...
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / canvas.js
index 5bd5e85..50c0ae4 100644 (file)
@@ -200,7 +200,7 @@ $.extend(Canvas.prototype, Backbone.Events, {
         /* globals MutationObserver */
         var observer = new MutationObserver(function(mutations) {
             mutations.forEach(function(mutation) {
-                if(documentElement.DocumentTextElement.isContentContainer(mutation.target)) {
+                if(canvas.dom[0].contains(mutation.target) && documentElement.DocumentTextElement.isContentContainer(mutation.target)) {
                     observer.disconnect();
                     if(mutation.target.data === '') {
                         mutation.target.data = utils.unicode.ZWS;
@@ -418,14 +418,6 @@ $.extend(Canvas.prototype, Backbone.Events, {
         if(position.element) {
             this._moveCaretToTextElement(position.element, position.offset);
         }
-    },
-
-    toggleGrid: function() {
-        this.rootWrapper.toggleClass('grid-on');
-        this.trigger('changed');
-    },
-    isGridToggled: function() {
-        return this.rootWrapper.hasClass('grid-on');
     }
 });