mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 13:43:07 +00:00
fixes #93415
This commit is contained in:
parent
12b445140d
commit
867f017697
5 changed files with 32 additions and 10 deletions
|
@ -4,6 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.context-view {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
z-index: 2500;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export interface IDelegate {
|
|||
}
|
||||
|
||||
export interface IContextViewProvider {
|
||||
showContextView(delegate: IDelegate): void;
|
||||
showContextView(delegate: IDelegate, container?: HTMLElement): void;
|
||||
hideContextView(): void;
|
||||
layout(): void;
|
||||
}
|
||||
|
@ -255,9 +255,8 @@ export class ContextView extends Disposable {
|
|||
DOM.addClass(this.view, anchorPosition === AnchorPosition.BELOW ? 'bottom' : 'top');
|
||||
DOM.addClass(this.view, anchorAlignment === AnchorAlignment.LEFT ? 'left' : 'right');
|
||||
|
||||
const containerPosition = DOM.getDomNodePagePosition(this.container!);
|
||||
this.view.style.top = `${top - containerPosition.top}px`;
|
||||
this.view.style.left = `${left - containerPosition.left}px`;
|
||||
this.view.style.top = `${top}px`;
|
||||
this.view.style.left = `${left}px`;
|
||||
this.view.style.width = 'initial';
|
||||
}
|
||||
|
||||
|
|
|
@ -6,3 +6,9 @@
|
|||
.monaco-select-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.monaco-select-box-dropdown-container {
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
|||
private _isVisible: boolean;
|
||||
private selectBoxOptions: ISelectBoxOptions;
|
||||
private selectElement: HTMLSelectElement;
|
||||
private container?: HTMLElement;
|
||||
private options: ISelectOptionItem[] = [];
|
||||
private selected: number;
|
||||
private readonly _onDidSelect: Emitter<ISelectData>;
|
||||
|
@ -307,6 +308,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
|||
}
|
||||
|
||||
public render(container: HTMLElement): void {
|
||||
this.container = container;
|
||||
dom.addClass(container, 'select-container');
|
||||
container.appendChild(this.selectElement);
|
||||
this.applyStyles();
|
||||
|
@ -442,7 +444,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
|||
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
|
||||
},
|
||||
anchorPosition: this._dropDownPosition
|
||||
});
|
||||
}, this.container);
|
||||
|
||||
// Hide so we can relay out
|
||||
this._isVisible = true;
|
||||
|
@ -457,7 +459,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
|||
dom.toggleClass(this.selectElement, 'synthetic-focus', false);
|
||||
},
|
||||
anchorPosition: this._dropDownPosition
|
||||
});
|
||||
}, this.container);
|
||||
|
||||
// Track initial selection the case user escape, blur
|
||||
this._currentSelection = this.selected;
|
||||
|
|
|
@ -12,13 +12,15 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
|||
_serviceBrand: undefined;
|
||||
|
||||
private contextView: ContextView;
|
||||
private container: HTMLElement;
|
||||
|
||||
constructor(
|
||||
@ILayoutService readonly layoutService: ILayoutService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.contextView = this._register(new ContextView(layoutService.container));
|
||||
this.container = layoutService.container;
|
||||
this.contextView = this._register(new ContextView(this.container));
|
||||
this.layout();
|
||||
|
||||
this._register(layoutService.onLayout(() => this.layout()));
|
||||
|
@ -30,7 +32,20 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
|||
this.contextView.setContainer(container);
|
||||
}
|
||||
|
||||
showContextView(delegate: IContextViewDelegate): void {
|
||||
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): void {
|
||||
|
||||
if (container) {
|
||||
if (container !== this.container) {
|
||||
this.container = container;
|
||||
this.setContainer(container);
|
||||
}
|
||||
} else {
|
||||
if (this.container !== this.layoutService.container) {
|
||||
this.container = this.layoutService.container;
|
||||
this.setContainer(this.container);
|
||||
}
|
||||
}
|
||||
|
||||
this.contextView.show(delegate);
|
||||
}
|
||||
|
||||
|
@ -41,4 +56,4 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
|||
hideContextView(data?: any): void {
|
||||
this.contextView.hide(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue