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-x[-rw-r--r--]js/io/document/text-document.js38
1 files changed, 27 insertions, 11 deletions
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index 3506891a..683c513c 100644..100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -17,16 +17,10 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
17 } 17 }
18 }, 18 },
19 19
20 _textArea: { value: null, enumerable: false }, 20 _textArea: {value: null, enumerable: false },
21 21
22 // Temporary Save the source
23 _source: { value: null, enumerable: false}, 22 _source: { value: null, enumerable: false},
24 23
25 textArea: {
26 get: function() { return this._textArea;},
27 set: function(value) { this._textArea = value; }
28 },
29
30 source: { 24 source: {
31 get: function() { return this._source;}, 25 get: function() { return this._source;},
32 set: function(value) { this._source = value;} 26 set: function(value) { this._source = value;}
@@ -39,6 +33,10 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
39 33
40 34
41 // GETTERS / SETTERS 35 // GETTERS / SETTERS
36 textArea: {
37 get: function() { return this._textArea; },
38 set: function(value) { this._textArea = value; }
39 },
42 editor: { 40 editor: {
43 get: function() { return this._codeEditor.editor; }, 41 get: function() { return this._codeEditor.editor; },
44 set: function(value) { this._codeEditor.editor = value} 42 set: function(value) { this._codeEditor.editor = value}
@@ -52,11 +50,12 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
52 50
53 // PUBLIC METHODS 51 // PUBLIC METHODS
54 initialize: { 52 initialize: {
55 value: function(doc, uuid, textArea, callback) { 53 value: function(doc, uuid, textArea, container, callback) {
56 this.init(doc.name, doc.uri, doc.type, textArea, uuid, callback); 54 this.init(doc.name, doc.uri, doc.type, container, uuid);
57 this.textArea = textArea.firstChild;
58 this.currentView = "code"; 55 this.currentView = "code";
59 this._loadContent(); 56 this.textArea = textArea;
57
58// this._loadContent();
60 } 59 }
61 }, 60 },
62 61
@@ -86,6 +85,23 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
86 85
87 xhr.send(''); 86 xhr.send('');
88 } 87 }
88 },
89
90 /**
91 * public method
92 * parameter:
93 * removeCodeMirrorDivFlag - for code view, tell to remove the codemirror div after saving
94 */
95 save:{
96 value:function(removeCodeMirrorDivFlag){
97 this.editor.save();
98 this.dirtyFlag=false;
99 if(removeCodeMirrorDivFlag === true){
100 var codemirrorDiv = this.textArea.parentNode.querySelector(".CodeMirror");
101 if(!!codemirrorDiv){codemirrorDiv.parentNode.removeChild(codemirrorDiv);}
102 }
103 //persist to filesystem
104 }
89 } 105 }
90 106
91}); \ No newline at end of file 107}); \ No newline at end of file