aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/document/document-controller.js43
1 files changed, 26 insertions, 17 deletions
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index e36181bf..15f026a3 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -37,7 +37,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
37 value: "function CodeMirror(place, givenOptions) {" + 37 value: "function CodeMirror(place, givenOptions) {" +
38 "// Determine effective options based on given values and defaults." + 38 "// Determine effective options based on given values and defaults." +
39 "var options = {}, defaults = CodeMirror.defaults; }" 39 "var options = {}, defaults = CodeMirror.defaults; }"
40 }, 40 },
41 41
42 activeDocument: { 42 activeDocument: {
43 get: function() { 43 get: function() {
@@ -45,7 +45,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
45 }, 45 },
46 set: function(doc) { 46 set: function(doc) {
47 if(this._activeDocument) this._activeDocument.isActive = false; 47 if(this._activeDocument) this._activeDocument.isActive = false;
48 48
49 if(this._documents.indexOf(doc) === -1) this._documents.push(doc); 49 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
50 50
51 this._activeDocument = doc; 51 this._activeDocument = doc;
@@ -66,11 +66,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
66 this.eventManager.addEventListener("executeSave", this, false); 66 this.eventManager.addEventListener("executeSave", this, false);
67 67
68 this.eventManager.addEventListener("recordStyleChanged", this, false); 68 this.eventManager.addEventListener("recordStyleChanged", this, false);
69
70 // Temporary testing opening a new file after Ninja has loaded
71 this.eventManager.addEventListener("executeNewProject", this, false);
69 } 72 }
70 }, 73 },
71 74
72 handleAppLoaded: { 75 handleAppLoaded: {
73 value: function() { 76 value: function() {
77 //this.openDocument({"type": "html"});
78 }
79 },
80
81 handleExecuteNewProject: {
82 value: function() {
74 this.openDocument({"type": "html"}); 83 this.openDocument({"type": "html"});
75 } 84 }
76 }, 85 },
@@ -107,9 +116,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
107 116
108 if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view 117 if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view
109 118
110 }else{ 119 } else {
111 //open design view 120 //open design view
112 } 121 }
113 } 122 }
114 }, 123 },
115 124
@@ -153,7 +162,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
153 openFileCallback:{ 162 openFileCallback:{
154 value:function(doc){ 163 value:function(doc){
155 this.openDocument(doc); 164 this.openDocument(doc);
156 } 165 }
157 }, 166 },
158 167
159 168
@@ -188,7 +197,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
188 197
189 this.textDocumentOpened(newDoc); 198 this.textDocumentOpened(newDoc);
190 199
191 } 200 }
192 201
193 // } catch (err) { 202 // } catch (err) {
194 // console.log("Could not open Document ", err); 203 // console.log("Could not open Document ", err);
@@ -220,24 +229,24 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
220 } 229 }
221 230
222 DocumentManager._codeEditor.editor = CodeMirror.fromTextArea(doc.textArea, { 231 DocumentManager._codeEditor.editor = CodeMirror.fromTextArea(doc.textArea, {
223 lineNumbers: true, 232 lineNumbers: true,
224 mode: type, 233 mode: type,
225 onCursorActivity: function() { 234 onCursorActivity: function() {
226 DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null); 235 DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null);
227 DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline"); 236 DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline");
228 } 237 }
229 }); 238 });
230 DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline"); 239 DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline");
231 */ 240 */
232 241
233 } 242 }
234 }, 243 },
235 244
236 closeDocument: { 245 closeDocument: {
237 value: function(id) { 246 value: function(id) {
238 if(this.activeDocument.dirtyFlag === true){ 247 if(this.activeDocument.dirtyFlag === true){
239 //if file dirty then alert user to save 248 //if file dirty then alert user to save
240 } 249 }
241 250
242 var doc = this._findDocumentByUUID(id); 251 var doc = this._findDocumentByUUID(id);
243 this._removeDocumentView(doc.container); 252 this._removeDocumentView(doc.container);
@@ -362,9 +371,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
362 this.application.ninja.stage.restoreScroll(); 371 this.application.ninja.stage.restoreScroll();
363 this.application.ninja.stage.hideCanvas(false); 372 this.application.ninja.stage.hideCanvas(false);
364 this.application.ninja.stage.stageView.showRulers(); 373 this.application.ninja.stage.stageView.showRulers();
365 }
366 } 374 }
367 } 375 }
376 }
368 }, 377 },
369 378
370 _removeDocumentView: { 379 _removeDocumentView: {
@@ -405,5 +414,5 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
405 value: function() { 414 value: function() {
406 return "userDocument_" + (this._iframeCounter++); 415 return "userDocument_" + (this._iframeCounter++);
407 } 416 }
408 } 417 }
409}); \ No newline at end of file 418});