smartxml: optimize undo for setText transformation
[fnpeditor.git] / src / smartxml / core.js
index 867353d..4d3c2c1 100644 (file)
@@ -188,9 +188,15 @@ var elementNodeTransformations = {
 };
 
 var textNodeTransformations = {
-    setText: function(text) {
-        this.nativeNode.data = text;
-        this.triggerTextChangeEvent();
+    setText: {
+        impl: function(t, text) {
+            t.oldText = this.getText();
+            this.nativeNode.data = text;
+            this.triggerTextChangeEvent();
+        },
+        undo: function(t) {
+            this.setText(t.oldText);
+        }
     },
 
     appendText: function(text) {