diff options
Diffstat (limited to 'js')
36 files changed, 188 insertions, 212 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index aaefd923..49dbe3cb 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -23,7 +23,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
23 | value: function(){ | 23 | value: function(){ |
24 | if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { | 24 | if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { |
25 | this.disabled = true; | 25 | this.disabled = true; |
26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); | 26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | }, | 29 | }, |
@@ -65,7 +65,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
65 | 65 | ||
66 | parentNode = this.container; | 66 | parentNode = this.container; |
67 | 67 | ||
68 | while(parentNode !== this.application.ninja.currentDocument.documentRoot) { | 68 | while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { |
69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
70 | parentNode = parentNode.parentNode; | 70 | parentNode = parentNode.parentNode; |
71 | } | 71 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index aa037bd4..2c34eedf 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -13,24 +13,14 @@ var Montage = require("montage/core/core").Montage, | |||
13 | TextDocument = require("js/document/document-text").TextDocument; | 13 | TextDocument = require("js/document/document-text").TextDocument; |
14 | //////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////// |
15 | // | 15 | // |
16 | var DocumentController = exports.DocumentController = Montage.create(Component, { | 16 | exports.DocumentController = Montage.create(Component, { |
17 | hasTemplate: { | 17 | // |
18 | value: false | 18 | hasTemplate: {value: false}, |
19 | }, | 19 | _documents: {value: []}, |
20 | 20 | //TODO: what is this?!?! | |
21 | _documents: { | 21 | _hackInitialStyles: {value: true}, |
22 | value: [] | ||
23 | }, | ||
24 | |||
25 | _hackRootFlag: { | ||
26 | value: false | ||
27 | }, | ||
28 | |||
29 | _hackInitialStyles: { | ||
30 | value: true | ||
31 | }, | ||
32 | |||
33 | _activeDocument: { value: null }, | 22 | _activeDocument: { value: null }, |
23 | //TODO: Are any of these needed? | ||
34 | _iframeCounter: { value: 1, enumerable: false }, | 24 | _iframeCounter: { value: 1, enumerable: false }, |
35 | _iframeHolder: { value: null, enumerable: false }, | 25 | _iframeHolder: { value: null, enumerable: false }, |
36 | _textHolder: { value: null, enumerable: false }, | 26 | _textHolder: { value: null, enumerable: false }, |
@@ -41,7 +31,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
41 | return this._activeDocument; | 31 | return this._activeDocument; |
42 | }, | 32 | }, |
43 | set: function(doc) { | 33 | set: function(doc) { |
44 | // if(!!this._activeDocument){ this._activeDocument.isActive = false;} | 34 | //if(!!this._activeDocument){ this._activeDocument.isActive = false;} |
45 | 35 | ||
46 | this._activeDocument = doc; | 36 | this._activeDocument = doc; |
47 | 37 | ||
@@ -53,7 +43,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
53 | }, | 43 | }, |
54 | 44 | ||
55 | deserializedFromTemplate: { | 45 | deserializedFromTemplate: { |
56 | value: function() { | 46 | value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name]) |
57 | this.eventManager.addEventListener("appLoaded", this, false); | 47 | this.eventManager.addEventListener("appLoaded", this, false); |
58 | this.eventManager.addEventListener("executeFileOpen", this, false); | 48 | this.eventManager.addEventListener("executeFileOpen", this, false); |
59 | this.eventManager.addEventListener("executeNewFile", this, false); | 49 | this.eventManager.addEventListener("executeNewFile", this, false); |
@@ -69,17 +59,22 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
69 | 59 | ||
70 | 60 | ||
71 | //TODO: Ensure these APIs are not needed | 61 | //TODO: Ensure these APIs are not needed |
62 | redirectRequests: { | ||
63 | value: false | ||
64 | }, | ||
72 | //////////////////////////////////////////////////////////////////// | 65 | //////////////////////////////////////////////////////////////////// |
73 | // | 66 | // |
74 | handleWebRequest: { | 67 | handleWebRequest: { |
75 | value: function (request) { | 68 | value: function (request) { |
76 | //TODO: Check if frameId is proper | 69 | //TODO: Check if frameId is proper |
77 | if (this._hackRootFlag && request.parentFrameId !== -1) { | 70 | if (this.redirectRequests && request.parentFrameId !== -1) { |
78 | //Checking for proper URL redirect (from different directories) | 71 | //Checking for proper URL redirect (from different directories) |
79 | if (request.url.indexOf('js/document/templates/banner') !== -1) { | 72 | if (request.url.indexOf('js/document/templates/banner') !== -1) { |
80 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/banner/'))[1]}; | 73 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/banner/'))[1]}; |
81 | } else if (request.url.indexOf('js/document/templates/html') !== -1) { | 74 | } else if (request.url.indexOf('js/document/templates/html') !== -1) { |
82 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/html/'))[1]}; | 75 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/html/'))[1]}; |
76 | } else if (request.url.indexOf('js/document/templates/app') !== -1) { | ||
77 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/app/'))[1]}; | ||
83 | } else { | 78 | } else { |
84 | //Error, not a valid folder | 79 | //Error, not a valid folder |
85 | } | 80 | } |
@@ -103,7 +98,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
103 | }, | 98 | }, |
104 | //////////////////////////////////////////////////////////////////// | 99 | //////////////////////////////////////////////////////////////////// |
105 | 100 | ||
106 | |||
107 | 101 | ||
108 | 102 | ||
109 | 103 | ||
@@ -150,7 +144,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
150 | // | 144 | // |
151 | saveExecuted: { | 145 | saveExecuted: { |
152 | value: function (value) { | 146 | value: function (value) { |
153 | //File saved, any callbacks or events should go here | 147 | //File saved, any callbacks or events should go here (must be added in handleExecuteSave passed as callback) |
154 | } | 148 | } |
155 | }, | 149 | }, |
156 | //////////////////////////////////////////////////////////////////// | 150 | //////////////////////////////////////////////////////////////////// |
@@ -160,9 +154,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
160 | // | 154 | // |
161 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ | 155 | if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ |
162 | // | 156 | // |
163 | this.activeDocument.model.saveAll(this.testCallback.bind(this)); //this.fileSaveResult.bind(this) | 157 | this.activeDocument.model.saveAll(); |
164 | } else { | 158 | } else { |
165 | //Error: | 159 | //TODO: Add error handling |
166 | } | 160 | } |
167 | } | 161 | } |
168 | }, | 162 | }, |
@@ -182,38 +176,22 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
182 | handleExecuteFileClose:{ | 176 | handleExecuteFileClose:{ |
183 | value: function(event) { | 177 | value: function(event) { |
184 | if (this.activeDocument) { | 178 | if (this.activeDocument) { |
185 | // this.activeDocument.closeDocument(); | ||
186 | this.closeFile(this.activeDocument); | 179 | this.closeFile(this.activeDocument); |
187 | } | 180 | } |
188 | } | 181 |