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.js65
1 files changed, 49 insertions, 16 deletions
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index 81162eba..e149c479 100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -4,11 +4,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage; 7////////////////////////////////////////////////////////////////////////
8var baseDocumentModule = require("js/io/document/base-document"); 8//
9 9var Montage = require("montage/core/core").Montage,
10 10 BaseDocument = require("js/io/document/base-document").BaseDocument;
11var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.BaseDocument, { 11////////////////////////////////////////////////////////////////////////
12//
13var TextDocument = exports.TextDocument = Montage.create(BaseDocument, {
12 // PRIVATE MEMBERS 14 // PRIVATE MEMBERS
13 _codeEditor: { 15 _codeEditor: {
14 value: { 16 value: {
@@ -21,7 +23,9 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
21 _hline: { value: null, enumerable: false }, 23 _hline: { value: null, enumerable: false },
22 24
23 _textArea: {value: null, enumerable: false }, 25 _textArea: {value: null, enumerable: false },
24 26
27 _userDocument: {value: null, enumerable: false },
28
25 _source: { value: null, enumerable: false}, 29 _source: { value: null, enumerable: false},
26 30
27 source: { 31 source: {
@@ -65,19 +69,43 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
65 }, 69 },
66 70
67 71
68 // PUBLIC METHODS 72 ////////////////////////////////////////////////////////////////////
73 //
69 initialize: { 74 initialize: {
70 value: function(doc, uuid, textArea, container, callback) { 75 value: function(file, uuid, textArea, container, callback) {
71 this.init(doc.name, doc.uri, doc.type, container, uuid); 76 //
72 this.currentView = "code"; 77 this._userDocument = file;
73 this.textArea = textArea; 78 //
74 79 this.init(file.name, file.uri, file.extension, container, uuid, callback);
75// this._loadContent(); 80 //
76 81 this.currentView = "code";
82 this.textArea = textArea;
77 } 83 }
78 }, 84 },
85 ////////////////////////////////////////////////////////////////////
86 //
87 save: {
88 enumerable: false,
89 value: function () {
90 //TODO: Improve sequence
91 this.editor.save();
92 return {mode: this._userDocument.extension, document: this._userDocument, content: this.textArea.value};
93 }
94 }
95 ////////////////////////////////////////////////////////////////////
96
97
98
99
100
101
102
103
104
105
79 106
80 // PRIVATE METHODS 107 /*
108// PRIVATE METHODS
81 _loadContent: { 109 _loadContent: {
82 value: function() { 110 value: function() {
83 // Start and AJAX call to load the HTML Document as a String 111 // Start and AJAX call to load the HTML Document as a String
@@ -104,11 +132,15 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
104 xhr.send(''); 132 xhr.send('');
105 } 133 }
106 }, 134 },
135*/
136 ////////////////////////////////////////////////////////////////////
137
107 138
108 /** 139 /**
109 * public method 140 * public method
110 */ 141 */
111 save:{ 142 /*
143save:{
112 value:function(){ 144 value:function(){
113 try{ 145 try{
114 this.editor.save(); 146 this.editor.save();
@@ -120,4 +152,5 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
120 } 152 }
121 } 153 }
122 } 154 }
155*/
123}); \ No newline at end of file 156}); \ No newline at end of file