editor: canvas fix - check for the case when mutation concerns already detached text...
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 25 Jun 2014 07:59:05 +0000 (09:59 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 25 Jun 2014 07:59:32 +0000 (09:59 +0200)
src/editor/modules/documentCanvas/canvas/canvas.js

index d4e16ad..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;