diff options
author | Jose Antonio Marquez | 2012-02-12 16:50:33 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-12 16:50:33 -0800 |
commit | b1fc4f84d92efeaa33ec239b662235c9e8218d0c (patch) | |
tree | 8f8c9aacb3c2a2315b8f44ca4400dfea95e21833 /js/io/document/html-document.js | |
parent | 9f2356c48b831d32d7278648656fe44b98bc4a1f (diff) | |
download | ninja-b1fc4f84d92efeaa33ec239b662235c9e8218d0c.tar.gz |
File Save (HTML only)
Added the ability to save an HTML file from design view, need to add CSS detection and saving (of styles in <style> only). Also need to add 'Save All' for all file attached to the HTML file.
Diffstat (limited to 'js/io/document/html-document.js')
-rwxr-xr-x | js/io/document/html-document.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js index fbb34a1d..2ece76c5 100755 --- a/js/io/document/html-document.js +++ b/js/io/document/html-document.js | |||
@@ -14,6 +14,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
14 | _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, | 14 | _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, |
15 | _iframe: { value: null, enumerable: false }, | 15 | _iframe: { value: null, enumerable: false }, |
16 | _server: { value: null, enumerable: false }, | 16 | _server: { value: null, enumerable: false }, |
17 | _templateDocument: { value: null, enumerable: false }, | ||
17 | _selectionModel: { value: [], enumerable: false }, | 18 | _selectionModel: { value: [], enumerable: false }, |
18 | _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false}, | 19 | _undoModel: { value: { "queue" : [], "position" : 0 }, enumerable: false}, |
19 | 20 | ||
@@ -359,6 +360,10 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
359 | // | 360 | // |
360 | handleEvent: { | 361 | handleEvent: { |
361 | value: function(event){ | 362 | value: function(event){ |
363 | //TODO: Clean up, using for prototyping save | ||
364 | this._templateDocument = {}; | ||
365 | this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; | ||
366 | this._templateDocument.body = this.iframe.contentWindow.document.getElementById("UserContent");; | ||
362 | // | 367 | // |
363 | this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent"); | 368 | this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent"); |
364 | this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG"); | 369 | this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG"); |
@@ -373,7 +378,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
373 | this.iframe.contentWindow.document.getElementById("userHead").innerHTML = this._userDocument.content.head; | 378 | this.iframe.contentWindow.document.getElementById("userHead").innerHTML = this._userDocument.content.head; |
374 | 379 | ||
375 | 380 | ||
376 | 381 | //TODO: Look at code below and clean up | |
377 | 382 | ||
378 | 383 | ||
379 | 384 | ||
@@ -461,7 +466,21 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
461 | * public method | 466 | * public method |
462 | * | 467 | * |
463 | */ | 468 | */ |
464 | save:{ | 469 | //////////////////////////////////////////////////////////////////// |
470 | // | ||
471 | save: { | ||
472 | enumerable: false, | ||
473 | value: function () { | ||
474 | //TODO: Add code view logic | ||
475 | return {mode: 'html', document: this._userDocument, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; | ||
476 | } | ||
477 | } | ||
478 | //////////////////////////////////////////////////////////////////// | ||
479 | //////////////////////////////////////////////////////////////////// | ||
480 | |||
481 | |||
482 | /* | ||
483 | save:{ | ||
465 | value:function(){ | 484 | value:function(){ |
466 | try{ | 485 | try{ |
467 | if(this.currentView === "design"){ | 486 | if(this.currentView === "design"){ |
@@ -477,5 +496,6 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
477 | } | 496 | } |
478 | } | 497 | } |
479 | } | 498 | } |
499 | */ | ||
480 | 500 | ||
481 | }); \ No newline at end of file | 501 | }); \ No newline at end of file |