mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-18 18:03:19 +01:00
Fixes diff editor height in monaco editor playground example. (#213585)
This commit is contained in:
committed by
GitHub
parent
4e111f4ad1
commit
e9a1af2326
@@ -56,7 +56,7 @@ export interface IDiffCodeEditorWidgetOptions {
|
||||
export class DiffEditorWidget extends DelegatingEditor implements IDiffEditor {
|
||||
public static ENTIRE_DIFF_OVERVIEW_WIDTH = OverviewRulerFeature.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
|
||||
private readonly elements = h('div.monaco-diff-editor.side-by-side', { style: { position: 'relative' } }, [
|
||||
private readonly elements = h('div.monaco-diff-editor.side-by-side', { style: { position: 'relative', height: '100%' } }, [
|
||||
h('div.editor.original@original', { style: { position: 'absolute', height: '100%', } }),
|
||||
h('div.editor.modified@modified', { style: { position: 'absolute', height: '100%', } }),
|
||||
h('div.accessibleDiffViewer@accessibleDiffViewer', { style: { position: 'absolute', height: '100%' } }),
|
||||
@@ -344,7 +344,12 @@ export class DiffEditorWidget extends DelegatingEditor implements IDiffEditor {
|
||||
private readonly _layoutInfo = derived(this, reader => {
|
||||
const fullWidth = this._rootSizeObserver.width.read(reader);
|
||||
const fullHeight = this._rootSizeObserver.height.read(reader);
|
||||
this.elements.root.style.height = fullHeight + 'px';
|
||||
|
||||
if (this._rootSizeObserver.automaticLayout) {
|
||||
this.elements.root.style.height = '100%';
|
||||
} else {
|
||||
this.elements.root.style.height = fullHeight + 'px';
|
||||
}
|
||||
|
||||
const sash = this._sash.read(reader);
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ export class ObservableElementSizeObserver extends Disposable {
|
||||
private readonly _height: ISettableObservable<number>;
|
||||
public get height(): IObservable<number> { return this._height; }
|
||||
|
||||
private _automaticLayout: boolean = false;
|
||||
public get automaticLayout(): boolean { return this._automaticLayout; }
|
||||
|
||||
constructor(element: HTMLElement | null, dimension: IDimension | undefined) {
|
||||
super();
|
||||
|
||||
@@ -115,6 +118,7 @@ export class ObservableElementSizeObserver extends Disposable {
|
||||
}
|
||||
|
||||
public setAutomaticLayout(automaticLayout: boolean): void {
|
||||
this._automaticLayout = automaticLayout;
|
||||
if (automaticLayout) {
|
||||
this.elementSizeObserver.startObserving();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user