From 6db7685f40310683e1cb6c4e98895d2007e787dc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 19 Jul 2012 16:24:17 -0700 Subject: IKNINJA-1899 - Fixed runtime error when undoing a delete shape action. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 4a4c9f88..f5b574fc 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -69,7 +69,7 @@ exports.ElementMediator = Montage.create(Component, { var undoLabel = "add element"; - document.application.undoManager.add(undoLabel, this.removeElements, this, elements, notify); + document.application.undoManager.add(undoLabel, this.removeElements, this, elements, notify, false); this.application.ninja.currentDocument.model.needsSave = true; @@ -80,9 +80,10 @@ exports.ElementMediator = Montage.create(Component, { }, removeElements:{ - value:function (elements, notify /* Used for the add undo */) { + value:function (elements, notify, callDeleteDelegate) { - if (this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { + if ((callDeleteDelegate || (typeof callDeleteDelegate === "undefined")) + && this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { return this.deleteDelegate.handleDelete(); // this.handleDelete.call(deleteDelegate); } @@ -98,7 +99,7 @@ exports.ElementMediator = Montage.create(Component, { var undoLabel = "add element"; - document.application.undoManager.add(undoLabel, this.addElements, this, elements, null, notify); + document.application.undoManager.add(undoLabel, this.addElements, this, elements, null, notify, false); this.application.ninja.currentDocument.model.needsSave = true; -- cgit v1.2.3