aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/html-document.js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-08 15:36:53 -0800
committerAnanya Sen2012-02-08 15:36:53 -0800
commit36b2e540f06cef3887e7d0fea60527fee51e2a40 (patch)
treeb636cba0ad7d4efedca3fbf791b05728f8cff37d /js/io/document/html-document.js
parent729bc48212d7244539c99ca206be673eed011115 (diff)
downloadninja-36b2e540f06cef3887e7d0fea60527fee51e2a40.tar.gz
fixed undo/redo for each code view document, changed new file integration with io mediator
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/document/html-document.js')
-rwxr-xr-xjs/io/document/html-document.js45
1 files changed, 24 insertions, 21 deletions
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js
index 8e1eb614..d51cd279 100755
--- a/js/io/document/html-document.js
+++ b/js/io/document/html-document.js
@@ -36,18 +36,13 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
36 36
37 _zoomFactor: { value: 100, enumerable: false }, 37 _zoomFactor: { value: 100, enumerable: false },
38 38
39 _codeEditor: {
40 value: {
41 "editor": { value: null, enumerable: false },
42 "hline": { value: null, enumerable: false }
43 }
44 },
45
46
47 // PUBLIC MEMBERS 39 // PUBLIC MEMBERS
48 cssLoadInterval: { value: null, enumerable: false }, 40 cssLoadInterval: { value: null, enumerable: false },
49 41
50 codeViewDocument:{ 42 _savedLeftScroll: {value:null},
43 _savedTopScroll: {value:null},
44
45 _codeViewDocument:{
51 writable: true, 46 writable: true,
52 enumerable: true, 47 enumerable: true,
53 value:null 48 value:null
@@ -58,10 +53,21 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
58 */ 53 */
59 54
60 // GETTERS / SETTERS 55 // GETTERS / SETTERS
61 editor: { 56
62 get: function() { return this._codeEditor.editor; }, 57 codeViewDocument:{
63 set: function(value) { this._codeEditor.editor = value} 58 get: function() { return this._codeViewDocument; },
64 }, 59 set: function(value) { this._codeViewDocument = value}
60 },
61
62 savedLeftScroll:{
63 get: function() { return this._savedLeftScroll; },
64 set: function(value) { this._savedLeftScroll = value}
65 },
66
67 savedTopScroll:{
68 get: function() { return this._savedTopScroll; },
69 set: function(value) { this._savedTopScroll = value}
70 },
65 71
66 selectionExclude: { 72 selectionExclude: {
67 get: function() { return this._selectionExclude; }, 73 get: function() { return this._selectionExclude; },
@@ -233,6 +239,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
233 this.currentView = "design"; 239 this.currentView = "design";
234 240
235 this._loadDocument(this.uri); 241 this._loadDocument(this.uri);
242
236 } 243 }
237 }, 244 },
238 245
@@ -444,20 +451,15 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
444 451
445 /** 452 /**
446 * public method 453 * public method
447 * parameter: 454 *
448 * removeCodeMirrorDivFlag - for code view, tell to remove the codemirror div after saving
449 */ 455 */
450 save:{ 456 save:{
451 value:function(removeCodeMirrorDivFlag){ 457 value:function(){
452 try{ 458 try{
453 if(this.currentView === "design"){ 459 if(this.currentView === "design"){
454 //generate html and save 460 //generate html and save
455 }else if((this.currentView === "code") && (this.codeViewDocument !== null)){ 461 }else if((this.currentView === "code") && (this.codeViewDocument !== null)){
456 if(removeCodeMirrorDivFlag === true){ 462 this.codeViewDocument.editor.save();
457 this.codeViewDocument.save(true);
458 }else{
459 this.codeViewDocument.save();
460 }
461 //persist to filesystem 463 //persist to filesystem
462 } 464 }
463 this.dirtyFlag=false; 465 this.dirtyFlag=false;
@@ -467,4 +469,5 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
467 } 469 }
468 } 470 }
469 } 471 }
472
470}); \ No newline at end of file 473}); \ No newline at end of file