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 +++++++++++++++++----- .../layout/document-bar.reel/document-bar.html | 9 +------ .../layout/document-bar.reel/document-bar.js | 6 +++++ js/document/views/design-code.js | 4 ++- js/stage/stage.reel/stage.css | 6 ++++- 6 files changed, 39 insertions(+), 18 deletions(-) (limited to 'js') 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); diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html index fb505a7c..f073b0e7 100755 --- a/js/components/layout/document-bar.reel/document-bar.html +++ b/js/components/layout/document-bar.reel/document-bar.html @@ -78,12 +78,6 @@ POSSIBILITY OF SUCH DAMAGE. } }, - "codeEditorControls":{ - "prototype": "js/code-editor/ui/code-editor-view-options.reel", - "properties": { - "element": {"#": "codeViewOptions"} - } - }, "owner": { "prototype": "js/components/layout/document-bar.reel", @@ -92,8 +86,7 @@ POSSIBILITY OF SUCH DAMAGE. "zoomControl": {"@": "hottext1"}, "btnDesign": {"#": "buttonDesign"}, "btnCode": {"#": "buttonCode"}, - "btnPreview": {"#": "buttonPreview"}, - "codeEditorControls": {"@": "codeEditorControls"} + "btnPreview": {"#": "buttonPreview"} } } } diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index bf84c652..c1d77668 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -217,6 +217,9 @@ exports.DocumentBar = Montage.create(Component, { value: function () { // this.showView('design', this.renderDesignView, this.btnDesign, this.btnCode); + + //todo - temp + this.application.ninja.documentBar.codeEditorControls.visible = false; } }, //////////////////////////////////////////////////////////////////// @@ -225,6 +228,9 @@ exports.DocumentBar = Montage.create(Component, { value: function () { // this.showView('code', this.renderCodeView, this.btnCode, this.btnDesign); + + //todo - temp + this.application.ninja.documentBar.codeEditorControls.visible = true; } }, //////////////////////////////////////////////////////////////////// diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js index 70afe785..bf6e186f 100644 --- a/js/document/views/design-code.js +++ b/js/document/views/design-code.js @@ -72,7 +72,9 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, { value: function (callback) { this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default"); - //todo : update options bar + this.textViewContainer.style.display = "block"; + + //todo : update options bar // if (callback) callback(); diff --git a/js/stage/stage.reel/stage.css b/js/stage/stage.reel/stage.css index 56b4c58c..d1277ef1 100755 --- a/js/stage/stage.reel/stage.css +++ b/js/stage/stage.reel/stage.css @@ -68,7 +68,11 @@ POSSIBILITY OF SUCH DAMAGE. .codeViewContainer .CodeMirror-scroll { height: 100%; - overflow: auto; + overflow-y: hidden; +} + +.codeViewContainer .CodeMirror-scrollbar { + display:none; } .codeViewContainer>div{ -- cgit v1.2.3