aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/text-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/document/text-document.js')
-rwxr-xr-xjs/io/document/text-document.js47
1 files changed, 31 insertions, 16 deletions
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index 7db8e91a..81162eba 100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -13,10 +13,13 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
13 _codeEditor: { 13 _codeEditor: {
14 value: { 14 value: {
15 "editor": { value: null, enumerable: false }, 15 "editor": { value: null, enumerable: false },
16 "hline": { value: null, enumerable: false } 16
17 } 17 }
18 }, 18 },
19 19
20 _editor: { value: null, enumerable: false },
21 _hline: { value: null, enumerable: false },
22
20 _textArea: {value: null, enumerable: false }, 23 _textArea: {value: null, enumerable: false },
21 24
22 _source: { value: null, enumerable: false}, 25 _source: { value: null, enumerable: false},
@@ -28,23 +31,37 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
28 31
29 // PUBLIC MEMBERS 32 // PUBLIC MEMBERS
30 33
34 _savedLeftScroll: {value:null},
35 _savedTopScroll: {value:null},
36
31 //****************************************// 37 //****************************************//
32 //PUBLIC API 38 //PUBLIC API
33 39
34 40
35 // GETTERS / SETTERS 41 // GETTERS / SETTERS
42
43 savedLeftScroll:{
44 get: function() { return this._savedLeftScroll; },
45 set: function(value) { this._savedLeftScroll = value}
46 },
47
48 savedTopScroll:{
49 get: function() { return this._savedTopScroll; },
50 set: function(value) { this._savedTopScroll = value}
51 },
52
36 textArea: { 53 textArea: {
37 get: function() { return this._textArea; }, 54 get: function() { return this._textArea; },
38 set: function(value) { this._textArea = value; } 55 set: function(value) { this._textArea = value; }
39 }, 56 },
40 editor: { 57 editor: {
41 get: function() { return this._codeEditor.editor; }, 58 get: function() { return this._editor; },
42 set: function(value) { this._codeEditor.editor = value} 59 set: function(value) { this._editor = value}
43 }, 60 },
44 61
45 hline: { 62 hline: {
46 get: function() { return this._codeEditor.hline; }, 63 get: function() { return this._hline; },
47 set: function(value) {this._codeEditor.hline = value; } 64 set: function(value) {this._hline = value; }
48 }, 65 },
49 66
50 67
@@ -56,6 +73,7 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
56 this.textArea = textArea; 73 this.textArea = textArea;
57 74
58// this._loadContent(); 75// this._loadContent();
76
59 } 77 }
60 }, 78 },
61 79
@@ -89,20 +107,17 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
89 107
90 /** 108 /**
91 * public method 109 * public method
92 * parameter:
93 * removeCodeMirrorDivFlag - for code view, tell to remove the codemirror div after saving
94 */ 110 */
95 save:{ 111 save:{
96 value:function(removeCodeMirrorDivFlag){ 112 value:function(){
97 this.editor.save(); 113 try{
98 this.dirtyFlag=false; 114 this.editor.save();
99 if(removeCodeMirrorDivFlag === true){ 115 //persist textArea.value to filesystem
100 var codemirrorDiv = this.textArea.parentNode.querySelector(".CodeMirror"); 116 this.dirtyFlag=false;
101 if(!!codemirrorDiv){codemirrorDiv.parentNode.removeChild(codemirrorDiv);} 117 }catch(e){
118 console.log("Error while saving "+this.uri);
119 console.log(e.stack);
102 } 120 }
103 //console.log("$$$saved : "+this.uri+" : "+this.textArea.value);
104 //persist to filesystem
105 } 121 }
106 } 122 }
107
108}); \ No newline at end of file 123}); \ No newline at end of file