From f7f6c28185f0425aa99b5476e107e0852a119443 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 17 Dec 2013 11:51:08 +0100 Subject: [PATCH 1/1] smartxml: optimize undo for setText transformation --- src/smartxml/core.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) { -- 2.20.1