aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-17 11:26:02 -0800
committerAnanya Sen2012-02-17 11:26:02 -0800
commit3b862fe489a3320882f91ab56781fc5dc400c3d1 (patch)
treea3ae24b1427246801c2c6782c06637b40c6b8505
parentf3b6a62f110be31a9438a6172694b111ffd4d507 (diff)
downloadninja-3b862fe489a3320882f91ab56781fc5dc400c3d1.tar.gz
changed the document dirtying logic to be done in the feature that edits the document.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xjs/controllers/document-controller.js12
-rwxr-xr-xjs/mediators/element-mediator.js6
2 files changed, 5 insertions, 13 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 6f31e24d..232af4c9 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -59,12 +59,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
59 59
60 this.eventManager.addEventListener("recordStyleChanged", this, false); 60 this.eventManager.addEventListener("recordStyleChanged", this, false);
61 61
62 //event listener to detect a change in the html design view
63 this.eventManager.addEventListener("elementAdded", function(evt){self.markCurrentDocumentChanged()}, false);
64 this.eventManager.addEventListener("elementDeleted", function(evt){self.markCurrentDocumentChanged()}, false);
65 //todo: add all applicable event listeners
66 //end-event listener to detect a change in the html design view
67
68 } 62 }
69 }, 63 },
70 64
@@ -438,11 +432,5 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
438 value: function() { 432 value: function() {
439 return "userDocument_" + (this._iframeCounter++); 433 return "userDocument_" + (this._iframeCounter++);
440 } 434 }
441 },
442
443 markCurrentDocumentChanged:{
444 value: function(){
445 this.activeDocument.dirtyFlag = true;
446 }
447 } 435 }
448}); 436});
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 95aec2a3..e1eadda9 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -101,7 +101,10 @@ exports.ElementMediator = Montage.create(NJComponent, {
101 { 101 {
102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); 102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true);
103 } 103 }
104 if(!noEvent) NJevent("elementAdded", el); 104 if(!noEvent) {
105 this.application.ninja.documentController.activeDocument.dirtyFlag = true;
106 NJevent("elementAdded", el);
107 }
105 } 108 }
106 }, 109 },
107 110
@@ -127,6 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
127 _removeElement: { 130 _removeElement: {
128 value: function(el, rules) { 131 value: function(el, rules) {
129 ElementController.removeElement(el, rules); 132 ElementController.removeElement(el, rules);
133 this.application.ninja.documentController.activeDocument.dirtyFlag = true;
130 NJevent("elementDeleted", el); 134 NJevent("elementDeleted", el);
131 } 135 }
132 }, 136 },