refactoring setting text on a node
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / documentElement.js
index a08788b..3073e72 100644 (file)
@@ -189,18 +189,14 @@ $.extend(DocumentTextElement.prototype, {
         this.canvas = null;
         return this;
     },
-    handle: function(event) {
-        var toSet = event.meta.node.getText();
-        if(toSet === '') {
-            toSet = utils.unicode.ZWS;
+    setText: function(text) {
+        if(text === '') {
+            text = utils.unicode.ZWS;
         }
-        if(toSet !== this.getText()) {
-            this.setText(toSet);
+        if(text !== this.getText()) {
+            this.dom.contents()[0].data = text;
         }
     },
-    setText: function(text) {
-        this.dom.contents()[0].data = text;
-    },
     getText: function(options) {
         options = _.extend({raw: false}, options || {});
         var toret = this.dom.text();