wip: extracting core transformations
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / canvas.js
index b6ddf71..d13e2ea 100644 (file)
@@ -13,7 +13,7 @@ define([
 var TextHandler = function(canvas) {this.canvas = canvas; this.buffer = null};
 $.extend(TextHandler.prototype, {
     handle: function(node, text) {
-        console.log('canvas text handler: ' + text);
+        //console.log('canvas text handler: ' + text);
         this.setText(text, node);
         return;
         if(!this.node) {
@@ -38,7 +38,8 @@ $.extend(TextHandler.prototype, {
         }
     },
     setText: function(text, node) {
-        this.canvas.wlxmlDocument.transform('setText', {node:node, text: text});
+        //this.canvas.wlxmlDocument.transform('setText', {node:node, text: text});
+        node.transform('smartxml.setText', {text: text});
 
     }
 
@@ -104,7 +105,7 @@ $.extend(Canvas.prototype, {
                         mutation.target.data = mutation.target.data.replace(utils.unicode.ZWS, '');
                         canvas._moveCaretToTextElement(canvas.getDocumentElement(mutation.target), 'end');
                     }
-                    observer.observe(canvas.d[0], config);
+                    observer.observe(canvas.wrapper[0], config);
                     canvas.publisher('contentChanged');
 
                     var textElement = canvas.getDocumentElement(mutation.target),
@@ -119,7 +120,7 @@ $.extend(Canvas.prototype, {
             });
         });
         var config = { attributes: false, childList: false, characterData: true, subtree: true, characterDataOldValue: true};
-        observer.observe(this.d[0], config);
+        observer.observe(this.wrapper[0], config);
 
 
         this.wrapper.on('mouseover', '[document-node-element], [document-text-element]', function(e) {