aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/element-mediator.js
diff options
context:
space:
mode:
authorAnanya Sen2012-07-23 17:01:14 -0700
committerAnanya Sen2012-07-23 17:01:14 -0700
commit48d9ed19573a07c68da305d14ca6ab3a04d31d64 (patch)
treeb4bf6c48c7fdade2cf531d84cac3359489d38405 /js/mediators/element-mediator.js
parentc07a7a9d11bc8299fa9686544b18840cc8e640c2 (diff)
parentafc7ad4f240fdf7890a79c2d4d7f8eb2e7c30a34 (diff)
downloadninja-48d9ed19573a07c68da305d14ca6ab3a04d31d64.tar.gz
Merge branch 'refs/heads/Jose-Document' into Document
Diffstat (limited to 'js/mediators/element-mediator.js')
-rwxr-xr-xjs/mediators/element-mediator.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 9c9518a0..f5b574fc 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -49,7 +49,7 @@ exports.ElementMediator = Montage.create(Component, {
49 }, 49 },
50 50
51 addElements:{ 51 addElements:{
52 value:function (elements, rules, notify) { 52 value:function (elements, rules, notify, callAddDelegate) {
53 if (Array.isArray(elements)) { 53 if (Array.isArray(elements)) {
54 elements.forEach(function (element) { 54 elements.forEach(function (element) {
55 ElementController.addElement(element, rules); 55 ElementController.addElement(element, rules);
@@ -61,13 +61,15 @@ exports.ElementMediator = Montage.create(Component, {
61 61
62 } 62 }
63 63
64 if (this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { 64 if ((callAddDelegate || (typeof callAddDelegate === "undefined"))
65 && this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") {
66
65 this.addDelegate['onAddElements'].call(this.addDelegate, elements); 67 this.addDelegate['onAddElements'].call(this.addDelegate, elements);
66 } 68 }
67 69
68 var undoLabel = "add element"; 70 var undoLabel = "add element";
69 71
70 document.application.undoManager.add(undoLabel, this.removeElements, this, elements, notify); 72 document.application.undoManager.add(undoLabel, this.removeElements, this, elements, notify, false);
71 73
72 this.application.ninja.currentDocument.model.needsSave = true; 74 this.application.ninja.currentDocument.model.needsSave = true;
73 75
@@ -78,9 +80,10 @@ exports.ElementMediator = Montage.create(Component, {
78 }, 80 },
79 81
80 removeElements:{ 82 removeElements:{
81 value:function (elements, notify /* Used for the add undo */) { 83 value:function (elements, notify, callDeleteDelegate) {
82 84
83 if (this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { 85 if ((callDeleteDelegate || (typeof callDeleteDelegate === "undefined"))
86 && this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) {
84 return this.deleteDelegate.handleDelete(); 87 return this.deleteDelegate.handleDelete();
85 // this.handleDelete.call(deleteDelegate); 88 // this.handleDelete.call(deleteDelegate);
86 } 89 }
@@ -96,7 +99,7 @@ exports.ElementMediator = Montage.create(Component, {
96 99
97 var undoLabel = "add element"; 100 var undoLabel = "add element";
98 101
99 document.application.undoManager.add(undoLabel, this.addElements, this, elements, null, notify); 102 document.application.undoManager.add(undoLabel, this.addElements, this, elements, null, notify, false);
100 103
101 this.application.ninja.currentDocument.model.needsSave = true; 104 this.application.ninja.currentDocument.model.needsSave = true;
102 105