From e459be3d148347b313115b05fceb7845734f12d0 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 21 Mar 2019 12:03:34 +0100 Subject: [PATCH] hiding contextview --- src/app/editor/contextView.js | 6 +++++- src/app/editor/contextualListener.js | 4 ++-- src/app/editor/styles/contextView-styles.js | 8 ++++++++ src/app/panels/editor-panel.js | 15 ++------------- src/app/ui/landing-page/section.js | 4 ++-- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index 36199f251a..020abb78a0 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -31,13 +31,17 @@ class ContextView { this.sourceMappingDecoder = new SourceMappingDecoder() this.previousElement = null this.contextualListener.event.register('contextChanged', nodes => { + this.show() this._nodes = nodes this.update() }) + this.contextualListener.event.register('stopHighlighting', () => { + this.hide() + }) } render () { - const view = yo`
+ const view = yo`
${this._renderTarget()}
diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 3b28b64ba5..dcbc60077c 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -69,7 +69,6 @@ class ContextualListener { this.currentPosition = cursorPosition return } - this._stopHighlighting() this.currentPosition = cursorPosition this.currentFile = file if (compilationResult && compilationResult.data && compilationResult.data.sources[file]) { @@ -79,7 +78,7 @@ class ContextualListener { this._highlightExpressions(nodes[nodes.length - 1], compilationResult) } this.event.trigger('contextChanged', [nodes]) - } + } else this._stopHighlighting() } _buildIndex (compilationResult, source) { @@ -164,6 +163,7 @@ class ContextualListener { const event = this._activeHighlights[eventKey] this.editor.removeMarker(event.eventId, event.fileTarget) } + this.event.trigger('stopHighlighting', []) this._activeHighlights = [] } diff --git a/src/app/editor/styles/contextView-styles.js b/src/app/editor/styles/contextView-styles.js index e12ab49af2..eac4ab8134 100644 --- a/src/app/editor/styles/contextView-styles.js +++ b/src/app/editor/styles/contextView-styles.js @@ -43,6 +43,14 @@ var css = csjs` height: 13px; margin-right: 5px; } + .contextviewcontainer{ + position : absolute; + top : 39px; + z-index : 50; + left : 350px; + border-radius : 1px; + border : 2px solid var(--secondary); + } ` module.exports = css diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index e7b27ae535..7e5b713ebb 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -24,14 +24,7 @@ var css = csjs` height : 100%; width : 100%; } - .contextviewcontainer{ - position : absolute; - top : 39px; - z-index : 50; - left : 350px; - border-radius : 1px; - border : 2px solid var(--secondary); - } + ` class EditorPanel { @@ -64,12 +57,10 @@ class EditorPanel { self._deps.fileManager.events.on('currentFileChanged', (file) => { // we check upstream for "fileChanged" self._view.editor.style.display = 'block' - self._components.contextView.show() self._view.mainPanel.style.display = 'none' }) self.tabProxy.event.on('switchFile', (file) => { self._view.editor.style.display = 'block' - self._components.contextView.show() self._view.mainPanel.style.display = 'none' }) self.tabProxy.event.on('closeFile', (file) => { @@ -185,9 +176,7 @@ class EditorPanel { self._view.content = yo`
${self.tabProxy.renderTabsbar()} -
- ${self._components.contextView.render()} -
+ ${self._components.contextView.render()} ${self._view.editor} ${self._view.mainPanel} ${self._view.terminal} diff --git a/src/app/ui/landing-page/section.js b/src/app/ui/landing-page/section.js index 6ded9c32da..4a4c1dc21d 100644 --- a/src/app/ui/landing-page/section.js +++ b/src/app/ui/landing-page/section.js @@ -34,8 +34,8 @@ class Section { render () { let sectionLook = yo` -
-
${this.title}
+
+
${this.title}

`