diff options
author | Ananya Sen | 2012-02-17 11:07:42 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-17 11:07:42 -0800 |
commit | f3b6a62f110be31a9438a6172694b111ffd4d507 (patch) | |
tree | 56b30ce23149e7c778a04c59977b35a5fd258571 /js/controllers | |
parent | 4641dbefb6e8cb41f1f3d7f4d070d50bcaed94be (diff) | |
download | ninja-f3b6a62f110be31a9438a6172694b111ffd4d507.tar.gz |
-added keyboard control for saving documents
-mark html design view when element is added or deleted
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index b1a22c1b..6f31e24d 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -50,12 +50,21 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
50 | 50 | ||
51 | deserializedFromTemplate: { | 51 | deserializedFromTemplate: { |
52 | value: function() { | 52 | value: function() { |
53 | var self = this; | ||
54 | |||
53 | this.eventManager.addEventListener("appLoaded", this, false); | 55 | this.eventManager.addEventListener("appLoaded", this, false); |
54 | this.eventManager.addEventListener("executeFileOpen", this, false); | 56 | this.eventManager.addEventListener("executeFileOpen", this, false); |
55 | this.eventManager.addEventListener("executeNewFile", this, false); | 57 | this.eventManager.addEventListener("executeNewFile", this, false); |
56 | this.eventManager.addEventListener("executeSave", this, false); | 58 | this.eventManager.addEventListener("executeSave", this, false); |
57 | 59 | ||
58 | this.eventManager.addEventListener("recordStyleChanged", this, false); | 60 | this.eventManager.addEventListener("recordStyleChanged", this, false); |
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 | |||
59 | } | 68 | } |
60 | }, | 69 | }, |
61 | 70 | ||
@@ -88,8 +97,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
88 | //TODO: Check for appropiate structures | 97 | //TODO: Check for appropiate structures |
89 | handleExecuteSave: { | 98 | handleExecuteSave: { |
90 | value: function(event) { | 99 | value: function(event) { |
91 | //Text and HTML document classes should return the same save object for fileSave | 100 | if(!!this.activeDocument){ |
92 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | 101 | //Text and HTML document classes should return the same save object for fileSave |
102 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); | ||
103 | } | ||
93 | } | 104 | } |
94 | }, | 105 | }, |
95 | //////////////////////////////////////////////////////////////////// | 106 | //////////////////////////////////////////////////////////////////// |
@@ -427,5 +438,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
427 | value: function() { | 438 | value: function() { |
428 | return "userDocument_" + (this._iframeCounter++); | 439 | return "userDocument_" + (this._iframeCounter++); |
429 | } | 440 | } |
441 | }, | ||
442 | |||
443 | markCurrentDocumentChanged:{ | ||
444 | value: function(){ | ||
445 | this.activeDocument.dirtyFlag = true; | ||
430 | } | 446 | } |
447 | } | ||
431 | }); | 448 | }); |