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/ui') 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