From 53f524a567eedb8534bf6faccd746f9e4b7181fd Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 21 Sep 2016 07:40:37 +0200 Subject: [PATCH] no tabs: dirty over close action --- .../parts/editor/media/notabstitle.css | 38 +++++-------------- .../parts/editor/noTabsTitleControl.ts | 20 ++++------ 2 files changed, 17 insertions(+), 41 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/media/notabstitle.css b/src/vs/workbench/browser/parts/editor/media/notabstitle.css index 151b9484087..ccc1d8d5143 100644 --- a/src/vs/workbench/browser/parts/editor/media/notabstitle.css +++ b/src/vs/workbench/browser/parts/editor/media/notabstitle.css @@ -3,33 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* Title Decoration */ - -.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-decoration { - width: 18px; - padding-left: 2px; - opacity: 0.5; -} - -.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title.active .title-decoration { - opacity: 1; -} - -.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-decoration.dirty { - background-size: 16px; - background-position: left center; - background-repeat: no-repeat; -} - -.vs .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-decoration.dirty { - background: url('close-dirty.svg') center center no-repeat; -} - -.hc-black .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-decoration.dirty, -.vs-dark .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-decoration.dirty { - background: url('close-dirty-inverse.svg') center center no-repeat; -} - /* Title Label */ .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-label { @@ -37,7 +10,7 @@ overflow: hidden; text-overflow: ellipsis; position: relative; - padding-left: 2px; + padding-left: 20px; } .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .monaco-icon-label::before { @@ -53,4 +26,13 @@ .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title.active .title-actions { opacity: 1; +} + +.vs .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title.dirty .title-actions .close-editor-action { + background: url('close-dirty.svg') center center no-repeat; +} + +.vs-dark .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title.dirty .title-actions .close-editor-action, +.hc-black .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title.dirty .title-actions .close-editor-action { + background: url('close-dirty-inverse.svg') center center no-repeat; } \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts index a15f347d3b4..7e6e03dbb3f 100644 --- a/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts @@ -14,7 +14,6 @@ import {EditorLabel} from 'vs/workbench/browser/labels'; export class NoTabsTitleControl extends TitleControl { private titleContainer: HTMLElement; - private titleDecoration: HTMLElement; private editorLabel: EditorLabel; public setContext(group: IEditorGroup): void { @@ -34,11 +33,6 @@ export class NoTabsTitleControl extends TitleControl { // Detect mouse click this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.MOUSE_UP, (e: MouseEvent) => this.onTitleClick(e))); - // Left Title Decoration - this.titleDecoration = document.createElement('div'); - DOM.addClass(this.titleDecoration, 'title-decoration'); - this.titleContainer.appendChild(this.titleDecoration); - // Editor Label this.editorLabel = this.instantiationService.createInstance(EditorLabel, this.titleContainer, void 0); this.toDispose.push(this.editorLabel); @@ -114,6 +108,13 @@ export class NoTabsTitleControl extends TitleControl { DOM.removeClass(this.titleContainer, 'active'); } + // Dirty state + if (editor.isDirty()) { + DOM.addClass(this.titleContainer, 'dirty'); + } else { + DOM.removeClass(this.titleContainer, 'dirty'); + } + // Editor Label const resource = getResource(editor); const name = editor.getName() || ''; @@ -125,13 +126,6 @@ export class NoTabsTitleControl extends TitleControl { this.editorLabel.setLabel({ name, description, resource}, { title: verboseDescription, italic: !isPinned, extraClasses: ['title-label'] }); - // Editor Decoration - if (editor.isDirty()) { - DOM.addClass(this.titleDecoration, 'dirty'); - } else { - DOM.removeClass(this.titleDecoration, 'dirty'); - } - // Update Editor Actions Toolbar this.updateEditorActionsToolbar(); } -- GitLab