diff options
Diffstat (limited to 'js/io/document/text-document.js')
-rwxr-xr-x[-rw-r--r--] | js/io/document/text-document.js | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js index 3506891a..81162eba 100644..100755 --- a/js/io/document/text-document.js +++ b/js/io/document/text-document.js | |||
@@ -13,20 +13,17 @@ 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 | _textArea: { value: null, enumerable: false }, | 20 | _editor: { value: null, enumerable: false }, |
21 | _hline: { value: null, enumerable: false }, | ||
22 | |||
23 | _textArea: {value: null, enumerable: false }, | ||
21 | 24 | ||
22 | // Temporary Save the source | ||
23 | _source: { value: null, enumerable: false}, | 25 | _source: { value: null, enumerable: false}, |
24 | 26 | ||
25 | textArea: { | ||
26 | get: function() { return this._textArea;}, | ||
27 | set: function(value) { this._textArea = value; } | ||
28 | }, | ||
29 | |||
30 | source: { | 27 | source: { |
31 | get: function() { return this._source;}, | 28 | get: function() { return this._source;}, |
32 | set: function(value) { this._source = value;} | 29 | set: function(value) { this._source = value;} |
@@ -34,29 +31,49 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
34 | 31 | ||
35 | // PUBLIC MEMBERS | 32 | // PUBLIC MEMBERS |
36 | 33 | ||
34 | _savedLeftScroll: {value:null}, | ||
35 | _savedTopScroll: {value:null}, | ||
36 | |||
37 | //****************************************// | 37 | //****************************************// |
38 | //PUBLIC API | 38 | //PUBLIC API |
39 | 39 | ||
40 | 40 | ||
41 | // 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 | |||
53 | textArea: { | ||
54 | get: function() { return this._textArea; }, | ||
55 | set: function(value) { this._textArea = value; } | ||
56 | }, | ||
42 | editor: { | 57 | editor: { |
43 | get: function() { return this._codeEditor.editor; }, | 58 | get: function() { return this._editor; }, |
44 | set: function(value) { this._codeEditor.editor = value} | 59 | set: function(value) { this._editor = value} |
45 | }, | 60 | }, |
46 | 61 | ||
47 | hline: { | 62 | hline: { |
48 | get: function() { return this._codeEditor.hline; }, | 63 | get: function() { return this._hline; }, |
49 | set: function(value) {this._codeEditor.hline = value; } | 64 | set: function(value) {this._hline = value; } |
50 | }, | 65 | }, |
51 | 66 | ||
52 | 67 | ||
53 | // PUBLIC METHODS | 68 | // PUBLIC METHODS |
54 | initialize: { | 69 | initialize: { |
55 | value: function(doc, uuid, textArea, callback) { | 70 | value: function(doc, uuid, textArea, container, callback) { |
56 | this.init(doc.name, doc.uri, doc.type, textArea, uuid, callback); | 71 | this.init(doc.name, doc.uri, doc.type, container, uuid); |
57 | this.textArea = textArea.firstChild; | ||
58 | this.currentView = "code"; | 72 | this.currentView = "code"; |
59 | this._loadContent(); | 73 | this.textArea = textArea; |
74 | |||
75 | // this._loadContent(); | ||
76 | |||
60 | } | 77 | } |
61 | }, | 78 | }, |
62 | 79 | ||
@@ -86,6 +103,21 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
86 | 103 | ||
87 | xhr.send(''); | 104 | xhr.send(''); |
88 | } | 105 | } |
106 | }, | ||
107 | |||
108 | /** | ||
109 | * public method | ||
110 | */ | ||
111 | save:{ | ||
112 | value:function(){ | ||
113 | try{ | ||
114 | this.editor.save(); | ||
115 | //persist textArea.value to filesystem | ||
116 | this.dirtyFlag=false; | ||
117 | }catch(e){ | ||
118 | console.log("Error while saving "+this.uri); | ||
119 | console.log(e.stack); | ||
120 | } | ||
121 | } | ||
89 | } | 122 | } |
90 | |||
91 | }); \ No newline at end of file | 123 | }); \ No newline at end of file |