mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
discard star changes
This commit is contained in:
parent
41fe5c50e2
commit
74f8303803
3 changed files with 26 additions and 35 deletions
|
|
@ -432,7 +432,7 @@ export class UnpinEditorAction extends Action {
|
|||
label: string,
|
||||
@ICommandService private readonly commandService: ICommandService
|
||||
) {
|
||||
super(id, label, ThemeIcon.asClassName(Codicon.starFull));
|
||||
super(id, label, ThemeIcon.asClassName(Codicon.pinned));
|
||||
}
|
||||
|
||||
override run(context?: IEditorCommandsContext): Promise<void> {
|
||||
|
|
@ -440,24 +440,6 @@ export class UnpinEditorAction extends Action {
|
|||
}
|
||||
}
|
||||
|
||||
export class PinEditorAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.pinEditor';
|
||||
static readonly LABEL = localize('pinEditor', "Pin Editor");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@ICommandService private readonly commandService: ICommandService
|
||||
) {
|
||||
super(id, label, ThemeIcon.asClassName(Codicon.star));
|
||||
}
|
||||
|
||||
override async run(context?: IEditorCommandsContext): Promise<void> {
|
||||
return this.commandService.executeCommand('workbench.action.pinEditor', undefined, context);
|
||||
}
|
||||
}
|
||||
|
||||
export class CloseEditorTabAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.closeActiveEditor';
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@
|
|||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.tab-actions-right.sizing-shrink > .tab-actions,
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.tab-actions-right.sizing-fixed > .tab-actions {
|
||||
flex: 0;
|
||||
overflow: visible; /* ensure tab actions are always visible */
|
||||
overflow: hidden; /* let the tab actions be pushed out of view when sizing is set to shrink/fixed to make more room */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty.tab-actions-right.sizing-shrink > .tab-actions,
|
||||
|
|
@ -399,8 +399,18 @@
|
|||
overflow: visible; /* ...but still show the tab actions on hover, focus and when dirty or sticky */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-action-off:not(.dirty) > .tab-actions,
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky-compact > .tab-actions {
|
||||
display: none; /* only hide tab actions when sticky-compact */
|
||||
display: none; /* hide the tab actions when we are configured to hide it (unless dirty, but always when sticky-compact) */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active > .tab-actions .action-label, /* always show tab actions for active tab */
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab > .tab-actions .action-label:focus, /* always show tab actions on focus */
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-actions .action-label, /* always show tab actions on hover */
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover > .tab-actions .action-label, /* always show tab actions on hover */
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.sticky:not(.pinned-action-off) > .tab-actions .action-label, /* always show tab actions for sticky tabs */
|
||||
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.dirty > .tab-actions .action-label { /* always show tab actions for dirty tabs */
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-actions .actions-container {
|
||||
|
|
@ -434,11 +444,11 @@
|
|||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky:not(.pinned-action-off) > .tab-actions .action-label,
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
|
||||
opacity: 1;
|
||||
opacity: 0.5; /* show tab actions dimmed for inactive group */
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-actions .action-label {
|
||||
opacity: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* Tab Actions: Off */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import { MergeGroupMode, IMergeGroupOptions } from '../../../services/editor/com
|
|||
import { addDisposableListener, EventType, EventHelper, Dimension, scheduleAtNextAnimationFrame, findParentWithClass, clearNode, DragAndDropObserver, isMouseEvent, getWindow } from '../../../../base/browser/dom.js';
|
||||
import { localize } from '../../../../nls.js';
|
||||
import { IEditorGroupsView, EditorServiceImpl, IEditorGroupView, IInternalEditorOpenOptions, IEditorPartsView } from './editor.js';
|
||||
import { CloseEditorTabAction, PinEditorAction, UnpinEditorAction } from './editorActions.js';
|
||||
import { CloseEditorTabAction, UnpinEditorAction } from './editorActions.js';
|
||||
import { assertAllDefined, assertIsDefined } from '../../../../base/common/types.js';
|
||||
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
||||
import { basenameOrAuthority } from '../../../../base/common/resources.js';
|
||||
|
|
@ -113,7 +113,6 @@ export class MultiEditorTabsControl extends EditorTabsControl {
|
|||
|
||||
private readonly closeEditorAction = this._register(this.instantiationService.createInstance(CloseEditorTabAction, CloseEditorTabAction.ID, CloseEditorTabAction.LABEL));
|
||||
private readonly unpinEditorAction = this._register(this.instantiationService.createInstance(UnpinEditorAction, UnpinEditorAction.ID, UnpinEditorAction.LABEL));
|
||||
private readonly pinEditorAction = this._register(this.instantiationService.createInstance(PinEditorAction, PinEditorAction.ID, PinEditorAction.LABEL)); // Add this line
|
||||
|
||||
private readonly tabResourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER));
|
||||
private tabLabels: IEditorInputLabel[] = [];
|
||||
|
|
@ -1519,28 +1518,28 @@ export class MultiEditorTabsControl extends EditorTabsControl {
|
|||
this.redrawTabLabel(editor, tabIndex, tabContainer, tabLabelWidget, tabLabel);
|
||||
|
||||
// Action
|
||||
const hasCloseAction = options.tabActionCloseVisibility;
|
||||
const hasAction = true; // Always show actions
|
||||
const hasUnpinAction = isTabSticky && options.tabActionUnpinVisibility;
|
||||
const hasCloseAction = !hasUnpinAction && options.tabActionCloseVisibility;
|
||||
const hasAction = hasUnpinAction || hasCloseAction;
|
||||
|
||||
// Determine which action to show
|
||||
let tabAction;
|
||||
if (isTabSticky) {
|
||||
tabAction = this.unpinEditorAction;
|
||||
if (hasAction) {
|
||||
tabAction = hasUnpinAction ? this.unpinEditorAction : this.closeEditorAction;
|
||||
} else {
|
||||
tabAction = this.pinEditorAction; // Use pin action instead of close action
|
||||
// Even if the action is not visible, add it as it contains the dirty indicator
|
||||
tabAction = isTabSticky ? this.unpinEditorAction : this.closeEditorAction;
|
||||
}
|
||||
|
||||
// Update action bar
|
||||
if (!tabActionBar.hasAction(tabAction)) {
|
||||
if (!tabActionBar.isEmpty()) {
|
||||
tabActionBar.clear();
|
||||
}
|
||||
|
||||
tabActionBar.push(tabAction, { icon: true, label: false, keybinding: this.getKeybindingLabel(tabAction) });
|
||||
}
|
||||
|
||||
tabContainer.classList.toggle('sticky', isTabSticky);
|
||||
tabContainer.classList.toggle(`pinned-action-off`, false);
|
||||
tabContainer.classList.toggle(`close-action-off`, !hasCloseAction);
|
||||
tabContainer.classList.toggle(`pinned-action-off`, isTabSticky && !hasUnpinAction);
|
||||
tabContainer.classList.toggle(`close-action-off`, !hasUnpinAction && !hasCloseAction);
|
||||
|
||||
for (const option of ['left', 'right']) {
|
||||
tabContainer.classList.toggle(`tab-actions-${option}`, hasAction && options.tabActionLocation === option);
|
||||
|
|
|
|||
Loading…
Reference in a new issue