aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js72
1 files changed, 62 insertions, 10 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 63fe88ba..727c16eb 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -49,28 +49,80 @@ exports.StageView = Montage.create(Component, {
49 // Temporary function to create a Codemirror text view 49 // Temporary function to create a Codemirror text view
50 createTextView: { 50 createTextView: {
51 value: function(doc) { 51 value: function(doc) {
52// DocumentManager._hideCurrentDocument(); 52 this.application.ninja.documentController._hideCurrentDocument();
53 53
54 this.application.ninja.currentDocument.container.parentNode.style["display"] = "none"; 54 this.application.ninja.currentDocument.container.parentNode.style["display"] = "none";
55 55
56// stageManagerModule.stageManager._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 56 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
57// DocumentManager.activeDocument = doc; 57 this.application.ninja.documentController.activeDocument = doc;
58 58
59 this.element.appendChild(doc.textArea); 59 this.element.appendChild(doc.textArea);
60 60
61 var type;
62
63 switch(doc.documentType) {
64 case "css" :
65 type = "css";
66 break;
67 case "js" :
68 type = "javascript";
69 break;
70 }
71
72 //remove any previous Codemirror div
73 var codemirrorDiv = this.element.querySelector(".CodeMirror");
74 if(!!codemirrorDiv){
75 codemirrorDiv.parentNode.removeChild(codemirrorDiv);
76 }
61 77
62 var codeM = CodeMirror.fromTextArea(doc.textArea, { 78 var codeM = CodeMirror.fromTextArea(doc.textArea, {
63 lineNumbers: true, 79 lineNumbers: true,
64 mode: "javascript" 80 mode: type,
65// onCursorActivity: function() { 81 onCursorActivity: function() {
66// DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.hline, null); 82 this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.hline, null);
67// DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(DocumentManager._codeEditor.editor.getCursor().line, "activeline"); 83 this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.editor.getCursor().line, "activeline");
68// } 84 }
69 }); 85 });
70 86
71// DocumentManager._codeEditor.hline = DocumentManager._codeEditor.editor.setLineClass(0, "activeline"); 87 //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline");
88
89 this.application.ninja.stage.hideCanvas(true);
90
91 }
92 },
93
94 switchCodeView:{
95 value: function(doc){
96
97 this.application.ninja.documentController._hideCurrentDocument();
98
99 //remove any previous Codemirror div
100 var codemirrorDiv = this.element.querySelector(".CodeMirror");
101 if(!!codemirrorDiv){
102 codemirrorDiv.parentNode.removeChild(codemirrorDiv);
103 }
104
105 var type;
106
107 switch(doc.documentType) {
108 case "css" :
109 type = "css";
110 break;
111 case "js" :
112 type = "javascript";
113 break;
114 }
115
116 var codeM = CodeMirror.fromTextArea(doc.textArea, {
117 lineNumbers: true,
118 mode: type,
119 onCursorActivity: function() {
120 this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.hline, null);
121 this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.editor.getCursor().line, "activeline");
122 }
123 });
72 124
73 this.application.ninja.stage.hideCanvas(true); 125 //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline");
74 126
75 } 127 }
76 } 128 }