From 8652ad3f4a86e5019404ac90be9c7325ad077920 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 2 Dec 2013 14:22:00 +0100 Subject: [PATCH] wip: blocking nested transformations from being pushed on undo stack --- src/smartxml/smartxml.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index fc9715b..aa9a7c5 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -565,6 +565,7 @@ var Document = function(xml) { this.loadXML(xml); this.undoStack = []; this.redoStack = []; + this._transformationLevel = 0; }; $.extend(Document.prototype, Backbone.Events, { @@ -752,8 +753,12 @@ $.extend(Document.prototype, Backbone.Events, { } } if(transformation) { + this._transformationLevel++; toret = transformation.run(); - this.undoStack.push(transformation); + if(this._transformationLevel === 1) { + this.undoStack.push(transformation); + } + this._transformationLevel--; console.log('clearing redo stack'); this.redoStack = []; return toret; -- 2.20.1