no tabs: dirty over close action

This commit is contained in:
Benjamin Pasero 2016-09-21 07:40:37 +02:00
parent 07af5660c8
commit 53f524a567
2 changed files with 17 additions and 41 deletions

View file

@ -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;
}

View file

@ -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();
}