diff options
Diffstat (limited to 'js/io/document/document-controller.js')
-rwxr-xr-x | js/io/document/document-controller.js | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js index 7cc0eeeb..b900dee4 100755 --- a/js/io/document/document-controller.js +++ b/js/io/document/document-controller.js | |||
@@ -103,7 +103,32 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
103 | 103 | ||
104 | createNewFile:{ | 104 | createNewFile:{ |
105 | value:function(newFileObj){ | 105 | value:function(newFileObj){ |
106 | //console.log(newFileObj); | 106 | //console.log(newFileObj);//contains the template uri and the new file uri |
107 | if(!newFileObj) return; | ||
108 | this.application.ninja.ioMediator.fileNew(newFileObj.newFilePath, newFileObj.fileTemplateUri, this.openNewFile, this); | ||
109 | |||
110 | if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view | ||
111 | |||
112 | }else{ | ||
113 | //open design view | ||
114 | } | ||
115 | } | ||
116 | }, | ||
117 | |||
118 | /** | ||
119 | * Public method | ||
120 | * doc contains: | ||
121 | * type : file type, like js, css, etc | ||
122 | * name : file name | ||
123 | * source : file content | ||
124 | * uri : file uri | ||
125 | */ | ||
126 | openNewFile:{ | ||
127 | value:function(doc){ | ||
128 | if(!doc){ | ||
129 | doc = {"type": "js", "name": "filename", "source": "test file content", "uri": "/fs/fsd/"} ; | ||
130 | } | ||
131 | this.openDocument(doc); | ||
107 | } | 132 | } |
108 | }, | 133 | }, |
109 | 134 | ||
@@ -160,7 +185,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
160 | newDoc.initialize(doc, docUuid, textArea, textArea.parentNode); | 185 | newDoc.initialize(doc, docUuid, textArea, textArea.parentNode); |
161 | 186 | ||
162 | // Tmp this will be filled with the real content | 187 | // Tmp this will be filled with the real content |
163 | newDoc.textArea.innerHTML = doc.source; //this.tmpSourceForTesting; | 188 | newDoc.textArea.value = doc.source; //this.tmpSourceForTesting; |
164 | 189 | ||
165 | this.textDocumentOpened(newDoc); | 190 | this.textDocumentOpened(newDoc); |
166 | 191 | ||
@@ -175,7 +200,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
175 | textDocumentOpened: { | 200 | textDocumentOpened: { |
176 | value: function(doc) { | 201 | value: function(doc) { |
177 | 202 | ||
178 | this.activeDocument = doc; | 203 | |
179 | 204 | ||
180 | this.application.ninja.stage.stageView.createTextView(doc); | 205 | this.application.ninja.stage.stageView.createTextView(doc); |
181 | 206 | ||
@@ -377,7 +402,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
377 | value: function() { | 402 | value: function() { |
378 | if(this.activeDocument) { | 403 | if(this.activeDocument) { |
379 | this.activeDocument.container.style["display"] = "none"; | 404 | this.activeDocument.container.style["display"] = "none"; |
380 | //if(this.activeDocument.documentType === "htm" || this.activeDocument.documentType === "html") this.application.ninja.stage.toggleCanvas(); | 405 | if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ |
406 | this.activeDocument.container.parentNode.style["display"] = "none"; | ||
407 | this.application.ninja.stage.hideCanvas(true); | ||
408 | } | ||
381 | } | 409 | } |
382 | } | 410 | } |
383 | }, | 411 | }, |
@@ -386,7 +414,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
386 | value: function() { | 414 | value: function() { |
387 | if(this.activeDocument) { | 415 | if(this.activeDocument) { |
388 | this.activeDocument.container.style["display"] = "block"; | 416 | this.activeDocument.container.style["display"] = "block"; |
389 | //if(this.activeDocument.documentType === "htm" || this.activeDocument.documentType === "html") this.application.ninja.stage.toggleCanvas(); | 417 | if(this.activeDocument.currentView === "design" || this.activeDocument.currentView === "design"){ |
418 | this.activeDocument.container.parentNode.style["display"] = "block"; | ||
419 | this.application.ninja.stage.hideCanvas(false); | ||
420 | } | ||
390 | } | 421 | } |
391 | } | 422 | } |
392 | }, | 423 | }, |