aboutsummaryrefslogtreecommitdiff
path: root/js/code-editor
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-31 15:18:51 -0700
committerValerio Virgillito2012-07-31 15:18:51 -0700
commit4343e1f92547df9f7d42eecdf7e4feb47ad960e8 (patch)
tree27913b22fc5a899ae679013427d3cfe4b497837a /js/code-editor
parentd68ad5c4aa404f66303833367700983b8d7f5303 (diff)
parentb391dde5f319bf4c534e9fce523c22be3bb16ace (diff)
downloadninja-4343e1f92547df9f7d42eecdf7e4feb47ad960e8.tar.gz
Merge pull request #422 from joseeight/Document
Document Code View
Diffstat (limited to 'js/code-editor')
-rw-r--r--js/code-editor/code-editor-wrapper.js6
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html2
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js35
3 files changed, 39 insertions, 4 deletions
diff --git a/js/code-editor/code-editor-wrapper.js b/js/code-editor/code-editor-wrapper.js
index 57fe4d3a..65f42db2 100644
--- a/js/code-editor/code-editor-wrapper.js
+++ b/js/code-editor/code-editor-wrapper.js
@@ -131,6 +131,12 @@ exports.CodeEditorWrapper = Montage.create(Component, {
131 this.application.ninja.editorViewOptions.codeEditorWrapper = this; 131 this.application.ninja.editorViewOptions.codeEditorWrapper = this;
132 } 132 }
133 133
134 //TODO:add codeEditorWrapper
135 if(!this.application.ninja.documentBar.codeEditorWrapper){
136 this.application.ninja.documentBar.codeEditorWrapper = this;
137 }
138
139
134 editorOptions = { 140 editorOptions = {
135 lineNumbers: true, 141 lineNumbers: true,
136 matchBrackets:true, 142 matchBrackets:true,
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
index 476db181..e6cc3763 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
@@ -80,7 +80,7 @@ POSSIBILITY OF SUCH DAMAGE.
80<body> 80<body>
81<div data-montage-id="viewOptions" class="viewOptions"> 81<div data-montage-id="viewOptions" class="viewOptions">
82 <div> 82 <div>
83 <input class="zoomFont" data-montage-id="zoomFont"/> 83 <input class="zoomFont" data-montage-id="zoomFont" style="display:none;"/>
84 <div class="autoCodeComplete" > 84 <div class="autoCodeComplete" >
85 <input type="checkbox" data-montage-id="codeComplete" /> 85 <input type="checkbox" data-montage-id="codeComplete" />
86 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label> 86 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label>
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
index 9344d34c..2ca6118b 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
@@ -51,14 +51,31 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
51 51
52 this._currentDocument = value; 52 this._currentDocument = value;
53 53
54 if(!value || this._currentDocument.currentView === "design") { 54 if(!value || (this._currentDocument.currentView === "design")) {
55 this.visible = false; 55 this.visible = false;
56 } else { 56 } else if(this._currentDocument && this._currentDocument.currentView === "code") {
57 this.visible = true; 57
58 if(this._currentDocument.model.views.design){//code view of design document
59 this.application.ninja.editorViewOptions.visible = false;
60 //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo
61 }else if(!this._currentDocument.model.views.design){//code view for text document
62 this.application.ninja.editorViewOptions.visible = true;
63 //this.application.ninja.documentBar.codeEditorControls.visible = false;
64 }
65
58 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; 66 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension];
59 this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked; 67 this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked;
60 } 68 }
61 69
70 if(this._currentDocument && (this._currentDocument.currentView === "design")) {
71 this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false);
72 }
73
74 //hide the zoom hottext if it is code view of a design file
75 if (this._currentDocument && this._currentDocument.model && this._currentDocument.model.views.code){
76 this.zoomHottext.element.style.display = "block";
77 }
78
62 } 79 }
63 }, 80 },
64 81
@@ -209,6 +226,18 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
209 } 226 }
210 }, 227 },
211 228
229 handleChange: {
230 value: function(notification) {
231 if(notification.currentPropertyPath === "model.currentViewIdentifier") {
232 if(this.currentDocument.model.currentView.identifier === "design-code") {
233 //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo
234 } else {
235 //this.application.ninja.documentBar.codeEditorControls.visible = false;
236 }
237 }
238 }
239 },
240
212 handleFormat:{ 241 handleFormat:{
213 value: function(evt){ 242 value: function(evt){
214 var range = this.getSelectedRange(this.currentDocument.model.views.code.editor); 243 var range = this.getSelectedRange(this.currentDocument.model.views.code.editor);