diff options
author | Ananya Sen | 2012-05-18 16:56:16 -0700 |
---|---|---|
committer | Ananya Sen | 2012-05-18 16:56:16 -0700 |
commit | 7a22f7b368ef549a5b30c58a0f3900685b764bdb (patch) | |
tree | 44951af31368a5b287057e5cdddf0469cdc30298 /js/stage | |
parent | 65cea92d839bcd25ea9094a0798190a4dc4bea35 (diff) | |
download | ninja-7a22f7b368ef549a5b30c58a0f3900685b764bdb.tar.gz |
integrated open code view document in new dom architecture
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 120 |
1 files changed, 1 insertions, 119 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index ba94fadf..e8f29306 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -33,81 +33,6 @@ exports.StageView = Montage.create(Component, { | |||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Public method | 35 | * Public method |
36 | * Creates a textarea element which will contain the content of the opened text document. | ||
37 | */ | ||
38 | createTextAreaElement: { | ||
39 | value: function(uuid) { | ||
40 | var codeMirrorDiv = document.createElement("div"); | ||
41 | codeMirrorDiv.id = "codeMirror_" + uuid; | ||
42 | codeMirrorDiv.style.display = "block"; | ||
43 | this.element.appendChild(codeMirrorDiv); | ||
44 | |||
45 | var textArea = document.createElement("textarea"); | ||
46 | textArea.id = "code"; | ||
47 | textArea.name = "code"; | ||
48 | codeMirrorDiv.appendChild(textArea); | ||
49 | |||
50 | return textArea; | ||
51 | } | ||
52 | }, | ||
53 | |||
54 | /** | ||
55 | * Public method | ||
56 | * Creates a new instance of a code editor | ||
57 | */ | ||
58 | createTextView: { | ||
59 | value: function(doc) { | ||
60 | var type; | ||
61 | this.application.ninja.documentController._hideCurrentDocument(); | ||
62 | this.hideOtherDocuments(doc.uuid); | ||
63 | |||
64 | switch(doc.documentType) { | ||
65 | case "css" : | ||
66 | type = "css"; | ||
67 | break; | ||
68 | case "js" : | ||
69 | type = "javascript"; | ||
70 | break; | ||
71 | case "html" : | ||
72 | type = "htmlmixed"; | ||
73 | break; | ||
74 | case "json" : | ||
75 | type = "javascript"; | ||
76 | break; | ||
77 | case "php" : | ||
78 | type = "php"; | ||
79 | break; | ||
80 | case "pl" : | ||
81 | type = "perl"; | ||
82 | break; | ||
83 | case "py" : | ||
84 | type = "python"; | ||
85 | break; | ||
86 | case "rb" : | ||
87 | type = "ruby"; | ||
88 | break; | ||
89 | case "xml" : | ||
90 | type = "xml"; | ||
91 | break; | ||
92 | } | ||
93 | document.getElementById("codeMirror_"+doc.uuid).style.display="block"; | ||
94 | |||
95 | doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type, doc.documentType); | ||
96 | doc.editor.hline = doc.editor.setLineClass(0, "activeline"); | ||
97 | |||
98 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | ||
99 | this.application.ninja.documentController.activeDocument = doc; | ||
100 | this.application.ninja.stage.hideCanvas(true); | ||
101 | document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view | ||
102 | |||
103 | this.showCodeViewBar(true); | ||
104 | this.application.ninja.codeEditorController.applySettings(); | ||
105 | this.collapseAllPanels(); | ||
106 | } | ||
107 | }, | ||
108 | |||
109 | /** | ||
110 | * Public method | ||
111 | * Switches between documents. Document state data is saved and restored whereever applicable | 36 | * Switches between documents. Document state data is saved and restored whereever applicable |
112 | */ | 37 | */ |
113 | switchDocument:{ | 38 | switchDocument:{ |
@@ -157,16 +82,6 @@ exports.StageView = Montage.create(Component, { | |||
157 | } | 82 | } |
158 | }, | 83 | }, |
159 | 84 | ||
160 | /** | ||
161 | * Public method | ||
162 | * Switches between different views of a design document, like HTML design view, HTML code view | ||
163 | */ | ||
164 | switchDesignDocViews: { | ||
165 | value: function() { | ||
166 | //TODO | ||
167 | } | ||
168 | }, | ||
169 | |||
170 | showRulers:{ | 85 | showRulers:{ |
171 | value:function(){ | 86 | value:function(){ |
172 | this.application.ninja.rulerTop.style.display = "block"; | 87 | this.application.ninja.rulerTop.style.display = "block"; |
@@ -178,39 +93,6 @@ exports.StageView = Montage.create(Component, { | |||
178 | this.application.ninja.rulerTop.style.display = "none"; | 93 | this.application.ninja.rulerTop.style.display = "none"; |
179 | this.application.ninja.rulerLeft.style.display = "none"; | 94 | this.application.ninja.rulerLeft.style.display = "none"; |
180 | } | 95 | } |
181 | }, | ||
182 | showCodeViewBar:{ | ||
183 | value:function(isCodeView){ | ||
184 | if(isCodeView === true) { | ||
185 | this.application.ninja.editorViewOptions.element.style.display = "block"; | ||
186 | this.application.ninja.documentBar.element.style.display = "none"; | ||
187 | } else { | ||
188 | this.application.ninja.documentBar.element.style.display = "block"; | ||
189 | this.application.ninja.editorViewOptions.element.style.display = "none"; | ||
190 | } | ||
191 | } | ||
192 | }, | ||
193 | |||
194 | collapseAllPanels:{ | ||
195 | value:function(){ | ||
196 | this.application.ninja.panelSplitter.collapse(); | ||
197 | this.application.ninja.timelineSplitter.collapse(); | ||
198 | this.application.ninja.toolsSplitter.collapse(); | ||
199 | this.application.ninja.optionsSplitter.collapse(); | ||
200 | } | ||
201 | }, | ||
202 | restoreAllPanels:{ | ||
203 | value:function(){ | ||
204 | this.application.ninja.panelSplitter.restore(); | ||
205 | this.application.ninja.timelineSplitter.restore(); | ||
206 | this.application.ninja.toolsSplitter.restore(); | ||
207 | this.application.ninja.optionsSplitter.restore(); | ||
208 | } | ||
209 | }, | ||
210 | |||
211 | applyTheme:{ | ||
212 | value:function(themeClass){ | ||
213 | this.element.className = "codeViewContainer "+themeClass; | ||
214 | } | ||
215 | } | 96 | } |
97 | |||
216 | }); \ No newline at end of file | 98 | }); \ No newline at end of file |