mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
aux window - align layout()
behaviour with main window (#203479)
* aux window - dont forget to apply `filter` when copying attributes * actually align layouts
This commit is contained in:
parent
bc7fc03d6a
commit
4f143e0e28
|
@ -2341,9 +2341,11 @@ function camelCaseToHyphenCase(str: string) {
|
|||
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
}
|
||||
|
||||
export function copyAttributes(from: Element, to: Element): void {
|
||||
export function copyAttributes(from: Element, to: Element, filter?: string[]): void {
|
||||
for (const { name, value } of from.attributes) {
|
||||
to.setAttribute(name, value);
|
||||
if (!filter || filter.includes(name)) {
|
||||
to.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2357,7 +2359,7 @@ function copyAttribute(from: Element, to: Element, name: string): void {
|
|||
}
|
||||
|
||||
export function trackAttributes(from: Element, to: Element, filter?: string[]): IDisposable {
|
||||
copyAttributes(from, to);
|
||||
copyAttributes(from, to, filter);
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
|
|
|
@ -97,13 +97,7 @@ export class AuxiliaryWindow extends BaseWindow implements IAuxiliaryWindow {
|
|||
e.preventDefault();
|
||||
}));
|
||||
|
||||
this._register(addDisposableListener(this.window, EventType.RESIZE, () => {
|
||||
const dimension = getClientArea(this.window.document.body, this.container);
|
||||
position(this.container, 0, 0, 0, 0, 'relative');
|
||||
size(this.container, dimension.width, dimension.height);
|
||||
|
||||
this._onDidLayout.fire(dimension);
|
||||
}));
|
||||
this._register(addDisposableListener(this.window, EventType.RESIZE, () => this.layout()));
|
||||
|
||||
this._register(addDisposableListener(this.container, EventType.SCROLL, () => this.container.scrollTop = 0)); // Prevent container from scrolling (#55456)
|
||||
|
||||
|
@ -142,7 +136,11 @@ export class AuxiliaryWindow extends BaseWindow implements IAuxiliaryWindow {
|
|||
}
|
||||
|
||||
layout(): void {
|
||||
this._onDidLayout.fire(getClientArea(this.window.document.body, this.container));
|
||||
const dimension = getClientArea(this.window.document.body, this.container);
|
||||
position(this.container, 0, 0, 0, 0, 'relative');
|
||||
size(this.container, dimension.width, dimension.height);
|
||||
|
||||
this._onDidLayout.fire(dimension);
|
||||
}
|
||||
|
||||
override dispose(): void {
|
||||
|
|
Loading…
Reference in a new issue