From 7fa0c53c14e9029d2e3960cc81edf91592fd1768 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:26:20 -0700 Subject: added save for code view, fixed code view editor bug, reuse code editor options component in document bar Signed-off-by: Ananya Sen Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen --- .../code-editor-view-options.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'js/code-editor') 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 e2632d35..5ad36db5 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,10 +51,18 @@ exports.CodeEditorViewOptions = Montage.create(Component, { this._currentDocument = value; - if(!value || (this._currentDocument.currentView === "design") || ((this._currentDocument.model.views.design !== null))) { + if(!value || (this._currentDocument.currentView === "design")) { this.visible = false; - } else { - this.visible = true; + } else if(this._currentDocument.currentView === "code") { + + if(this._currentDocument.model.views.design){//code view of design document + this.application.ninja.editorViewOptions.visible = false; + this.application.ninja.documentBar.codeEditorControls.visible = true; + }else if(!this._currentDocument.model.views.design){//code view for text document + this.application.ninja.editorViewOptions.visible = true; + this.application.ninja.documentBar.codeEditorControls.visible = false; + } + this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked; } @@ -200,6 +208,11 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } else { this.autoCompleteLabel.classList.remove("disabled"); } + + //hide the zoom hottext if it is code view of a design file + if (this._currentDocument && this._currentDocument.model && this._currentDocument.model.views.design){ + this.zoomHottext.element.style.display = "none"; + } } }, -- cgit v1.2.3 From fa2e82cf10aaa4900a462410cbb99b5b0433a1b1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:28:58 -0700 Subject: fixing code editor double vertical scrollbar bug Signed-off-by: Ananya Sen Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen --- .../code-editor-view-options.html | 2 +- .../code-editor-view-options.js | 30 +++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'js/code-editor') 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.
- +
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 5ad36db5..70d033fb 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 @@ -57,16 +57,25 @@ exports.CodeEditorViewOptions = Montage.create(Component, { if(this._currentDocument.model.views.design){//code view of design document this.application.ninja.editorViewOptions.visible = false; - this.application.ninja.documentBar.codeEditorControls.visible = true; + //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo }else if(!this._currentDocument.model.views.design){//code view for text document this.application.ninja.editorViewOptions.visible = true; - this.application.ninja.documentBar.codeEditorControls.visible = false; + //this.application.ninja.documentBar.codeEditorControls.visible = false; } this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; this._currentDocument.model.views.code.editor.automaticCodeHint = this.codeCompleteCheck.checked; } + if(this._currentDocument && (this._currentDocument.currentView === "design")) { + this._currentDocument.addPropertyChangeListener("model.currentViewIdentifier", this, false); + } + + //hide the zoom hottext if it is code view of a design file + if (this._currentDocument && this._currentDocument.model && this._currentDocument.model.views.code){ + this.zoomHottext.element.style.display = "block"; + } + } }, @@ -208,11 +217,6 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } else { this.autoCompleteLabel.classList.remove("disabled"); } - - //hide the zoom hottext if it is code view of a design file - if (this._currentDocument && this._currentDocument.model && this._currentDocument.model.views.design){ - this.zoomHottext.element.style.display = "none"; - } } }, @@ -222,6 +226,18 @@ exports.CodeEditorViewOptions = Montage.create(Component, { } }, + handleChange: { + value: function(notification) { + if(notification.currentPropertyPath === "model.currentViewIdentifier") { + if(this.currentDocument.model.currentView.identifier === "design-code") { + //this.application.ninja.documentBar.codeEditorControls.visible = false;//todo + } else { + //this.application.ninja.documentBar.codeEditorControls.visible = false; + } + } + } + }, + handleFormat:{ value: function(evt){ var range = this.getSelectedRange(this.currentDocument.model.views.code.editor); -- cgit v1.2.3 From e7509af2b2fad6ab23ea07e6e46e88a4ee0d03f1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:29:16 -0700 Subject: adding null check for currentDocument to prevent error Signed-off-by: Ananya Sen --- .../ui/code-editor-view-options.reel/code-editor-view-options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/code-editor') 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 70d033fb..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 @@ -53,7 +53,7 @@ exports.CodeEditorViewOptions = Montage.create(Component, { if(!value || (this._currentDocument.currentView === "design")) { this.visible = false; - } else if(this._currentDocument.currentView === "code") { + } else if(this._currentDocument && this._currentDocument.currentView === "code") { if(this._currentDocument.model.views.design){//code view of design document this.application.ninja.editorViewOptions.visible = false; -- cgit v1.2.3