aboutsummaryrefslogtreecommitdiff
path: root/js/document/document-text.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-22 14:47:02 -0700
committerJose Antonio Marquez2012-05-22 14:47:02 -0700
commitc5dad8ddc94b2e1c80565dfee072bda88e8880da (patch)
tree122197204fff1b8adccfc089d6e6869e8c310550 /js/document/document-text.js
parentfe3b8f2d556c1919e4ad504f7f895f6c400d84d2 (diff)
parent9b6da637d9654727426c6d78f17e3804bbd84ce5 (diff)
downloadninja-c5dad8ddc94b2e1c80565dfee072bda88e8880da.tar.gz
Merge branch 'refs/heads/Ninja-DOM-Architecture' into Document
Conflicts: js/document/document-html.js
Diffstat (limited to 'js/document/document-text.js')
-rwxr-xr-xjs/document/document-text.js52
1 files changed, 49 insertions, 3 deletions
diff --git a/js/document/document-text.js b/js/document/document-text.js
index 2a469144..bb63f5f8 100755
--- a/js/document/document-text.js
+++ b/js/document/document-text.js
@@ -7,7 +7,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component; 10 Component = require("montage/ui/component").Component,
11 TextDocumentModel = require("js/document/models/text").TextDocumentModel,
12 CodeDocumentView = require("js/document/views/code").CodeDocumentView;
11//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
12// 14//
13exports.TextDocument = Montage.create(Component, { 15exports.TextDocument = Montage.create(Component, {
@@ -16,9 +18,53 @@ exports.TextDocument = Montage.create(Component, {
16 hasTemplate: { 18 hasTemplate: {
17 enumerable: false, 19 enumerable: false,
18 value: false 20 value: false
19 } 21 },
20 ////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////
23 //
24 model: {
25 value: null
26 },
27 ////////////////////////////////////////////////////////////////////
28 //
29
30 init:{
31 enumerable: false,
32 value : function(file, context, callback, view){
33 var codeDocumentView = CodeDocumentView.create(), container = null;
34
35 //Creating instance of Text Document Model
36 this.model = Montage.create(TextDocumentModel,{
37 file: {value: file},
38 parentContainer: {value: document.getElementById("codeViewContainer")},
39 views: {value: {'code': codeDocumentView, 'design': null}}
40 });
41
42 codeDocumentView.initialize(this.model.parentContainer);
43
44 codeDocumentView.textArea.value = file.content;
45 codeDocumentView.initializeTextView(file, this);
46
47 if (view === 'code') {
48 //TODO: Remove reference and use as part of model
49 this.currentView = 'code';
50 //Setting current view object to design
51 this.model.currentView = this.model.views.code;
52 }
53
54
55 callback.call(context, this);
56 }
57 },
58////////////////////////////////////////////////////////////////////
59 //
60 closeDocument: {
61 value: function (context, callback) {
62 var closed = this.model.close(null);
63
64 callback.call(context, this);
65 }
66 }
67////////////////////////////////////////////////////////////////////
22}); 68});
23//////////////////////////////////////////////////////////////////////// 69////////////////////////////////////////////////////////////////////////
24//////////////////////////////////////////////////////////////////////// \ No newline at end of file 70//////////////////////////////////////////////////////////////////////// \ No newline at end of file