fairly simple changes
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / canvas.js
index 96e3bea..c6a7c82 100644 (file)
@@ -10,7 +10,7 @@ define([
 ], function($, _, Backbone, logging, documentElement, keyboard, utils, wlxmlListener) {
     
 'use strict';
-/* global document:false, window:false, Node:false */
+/* global document:false, window:false, Node:false, gettext */
 
 var logger = logging.getLogger('canvas');
 
@@ -42,7 +42,13 @@ $.extend(TextHandler.prototype, {
     },
     setText: function(text, node) {
         //this.canvas.wlxmlDocument.transform('setText', {node:node, text: text});
-        node.setText(text);
+        node.document.transaction(function() {
+            node.setText(text);
+        }, {
+            metadata:{
+                description: gettext('Changing text')
+            }
+        });
 
     }
 
@@ -71,7 +77,7 @@ $.extend(Canvas.prototype, Backbone.Events, {
     },
 
     createElement: function(wlxmlNode) {
-        var Factory = wlxmlNode.nodeType === Node.TEXT_NODE ? documentElement.DocumentTextElement : documentElement.DocumentNodeElement;
+        var Factory = wlxmlNode.nodeType === Node.TEXT_NODE ?  documentElement.DocumentTextElement : documentElement.factoryForTag(wlxmlNode.getTagName());
         return new Factory(wlxmlNode, this);
     },