From 5a34cac9594d710f6e5675bee34dc16be1b4d8a0 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 16 Jul 2012 15:34:07 -0700 Subject: Fixed copy paste from external applications Signed-off-by: Ananya Sen --- js/mediators/element-mediator.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/mediators/element-mediator.js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 9c9518a0..4a4c9f88 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -49,7 +49,7 @@ exports.ElementMediator = Montage.create(Component, { }, addElements:{ - value:function (elements, rules, notify) { + value:function (elements, rules, notify, callAddDelegate) { if (Array.isArray(elements)) { elements.forEach(function (element) { ElementController.addElement(element, rules); @@ -61,7 +61,9 @@ exports.ElementMediator = Montage.create(Component, { } - if (this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { + if ((callAddDelegate || (typeof callAddDelegate === "undefined")) + && this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { + this.addDelegate['onAddElements'].call(this.addDelegate, elements); } -- cgit v1.2.3 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/element-mediator.js') 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