From: Aleksander Ɓukasz Date: Tue, 17 Dec 2013 10:51:08 +0000 (+0100) Subject: smartxml: optimize undo for setText transformation X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/f7f6c28185f0425aa99b5476e107e0852a119443 smartxml: optimize undo for setText transformation --- diff --git a/src/smartxml/core.js b/src/smartxml/core.js index 867353d..4d3c2c1 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -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) {