提交 1cef0f3c 编写于 作者: B Benjamin Pasero

[Regression 1.3] Command palette no longer mouse-accessible (fixes #8913)

上级 5dc69d3b
......@@ -24,6 +24,10 @@
cursor: pointer;
}
.monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-label span {
cursor: pointer;
}
.vs .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .title-label a,
.vs .monaco-workbench > .part.editor > .content > .one-editor-silo > .container > .title .tabs-container > .tab .tab-label a {
color: rgba(51, 51, 51, 0.5);
......
......@@ -26,7 +26,6 @@ export class NoTabsTitleControl extends TitleControl {
private currentPrimaryEditorActionIds: string[] = [];
private currentSecondaryEditorActionIds: string[] = [];
public setContext(group: IEditorGroup): void {
super.setContext(group);
......@@ -35,22 +34,14 @@ export class NoTabsTitleControl extends TitleControl {
public create(parent: HTMLElement): void {
super.create(parent);
this.titleContainer = parent;
// Pin on double click
this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.DBLCLICK, (e: MouseEvent) => {
DOM.EventHelper.stop(e);
this.onTitleDoubleClick();
}));
this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.DBLCLICK, (e: MouseEvent) => this.onTitleDoubleClick(e)));
// Detect mouse click
this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.MOUSE_UP, (e: MouseEvent) => {
DOM.EventHelper.stop(e, false);
this.onTitleClick(e);
}));
this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.MOUSE_UP, (e: MouseEvent) => this.onTitleClick(e)));
// Left Title Decoration
this.titleDecoration = document.createElement('div');
......@@ -67,6 +58,10 @@ export class NoTabsTitleControl extends TitleControl {
this.titleDescription = document.createElement('span');
labelContainer.appendChild(this.titleDescription);
// Detect title label & description click
this.toDispose.push(DOM.addDisposableListener(this.titleLabel, DOM.EventType.CLICK, (e: MouseEvent) => this.onTitleLabelClick(e)));
this.toDispose.push(DOM.addDisposableListener(this.titleDescription, DOM.EventType.CLICK, (e: MouseEvent) => this.onTitleLabelClick(e)));
this.titleContainer.appendChild(labelContainer);
// Right Actions Container
......@@ -81,7 +76,15 @@ export class NoTabsTitleControl extends TitleControl {
this.toDispose.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.CONTEXT_MENU, (e: Event) => this.onContextMenu({ group: this.context, editor: this.context.activeEditor }, e, this.titleContainer)));
}
private onTitleDoubleClick(): void {
private onTitleLabelClick(e: MouseEvent): void {
DOM.EventHelper.stop(e, false);
if (!this.dragged) {
this.quickOpenService.show();
}
}
private onTitleDoubleClick(e: MouseEvent): void {
DOM.EventHelper.stop(e);
if (!this.context) {
return;
}
......@@ -92,6 +95,7 @@ export class NoTabsTitleControl extends TitleControl {
}
private onTitleClick(e: MouseEvent): void {
DOM.EventHelper.stop(e, false);
if (!this.context) {
return;
}
......
......@@ -1057,12 +1057,14 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Allow to reorder positions by dragging the title
titleContainer.on(DOM.EventType.MOUSE_DOWN, (e: MouseEvent) => {
const position = this.findPosition(titleContainer.getHTMLElement());
if (!this.getTitleAreaControl(position).allowDragging(<any>e.target || e.srcElement)) {
const titleAreaControl = this.getTitleAreaControl(position);
if (!titleAreaControl.allowDragging(<any>e.target || e.srcElement)) {
return; // return early if we are not in the drag zone of the title widget
}
// Reset flag
wasDragged = false;
titleAreaControl.setDragged(false);
// Return early if there is only one editor active or the user clicked into the toolbar
if (this.getVisibleEditorCount() <= 1) {
......@@ -1206,6 +1208,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Update flag
this.dragging = false;
if (wasDragged) {
titleAreaControl.setDragged(true);
}
// Restore styles
this.parent.removeClass('drag');
......
......@@ -31,6 +31,7 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IMenuService} from 'vs/platform/actions/common/actions';
import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {ScrollableElement} from 'vs/base/browser/ui/scrollbar/scrollableElement';
import {ScrollbarVisibility} from 'vs/base/common/scrollable';
......@@ -58,9 +59,10 @@ export class TabsTitleControl extends TitleControl {
@IKeybindingService keybindingService: IKeybindingService,
@ITelemetryService telemetryService: ITelemetryService,
@IMessageService messageService: IMessageService,
@IMenuService menuService: IMenuService
@IMenuService menuService: IMenuService,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(contextMenuService, instantiationService, configurationService, editorService, editorGroupService, keybindingService, telemetryService, messageService, menuService);
super(contextMenuService, instantiationService, configurationService, editorService, editorGroupService, keybindingService, telemetryService, messageService, menuService, quickOpenService);
this.currentPrimaryGroupActionIds = [];
this.currentSecondaryGroupActionIds = [];
......
......@@ -28,6 +28,7 @@ import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {StandardMouseEvent} from 'vs/base/browser/mouseEvent';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {CloseEditorsInGroupAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, CloseEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, CloseRightEditorsInGroupAction, ShowEditorsInGroupAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
......@@ -43,6 +44,7 @@ export interface IToolbarActions {
export interface ITitleAreaControl {
setContext(group: IEditorGroup): void;
allowDragging(element: HTMLElement): boolean;
setDragged(dragged: boolean): void;
create(parent: HTMLElement): void;
getContainer(): HTMLElement;
refresh(instant?: boolean): void;
......@@ -59,6 +61,8 @@ export abstract class TitleControl implements ITitleAreaControl {
protected context: IEditorGroup;
protected toDispose: IDisposable[];
protected dragged: boolean;
protected closeEditorAction: CloseEditorAction;
protected pinEditorAction: KeepEditorAction;
protected closeOtherEditorsAction: CloseOtherEditorsInGroupAction;
......@@ -91,7 +95,8 @@ export abstract class TitleControl implements ITitleAreaControl {
@IKeybindingService protected keybindingService: IKeybindingService,
@ITelemetryService protected telemetryService: ITelemetryService,
@IMessageService protected messageService: IMessageService,
@IMenuService protected menuService: IMenuService
@IMenuService protected menuService: IMenuService,
@IQuickOpenService protected quickOpenService: IQuickOpenService
) {
this.toDispose = [];
this.stacks = editorGroupService.getStacksModel();
......@@ -116,6 +121,10 @@ export abstract class TitleControl implements ITitleAreaControl {
return TitleControl.draggedEditor;
}
public setDragged(dragged: boolean): void {
this.dragged = dragged;
}
protected onEditorDragStart(editor: IEditorIdentifier): void {
TitleControl.draggedEditor = editor;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册