mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-27 02:27:53 +01:00
BaseEditor exposes onDidChange, EditorControl forwards event
This commit is contained in:
@@ -14,7 +14,7 @@ import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/group/
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { LRUCache } from 'vs/base/common/map';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { once } from 'vs/base/common/event';
|
||||
import { once, Event } from 'vs/base/common/event';
|
||||
import { isEmptyObject } from 'vs/base/common/types';
|
||||
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
|
||||
|
||||
@@ -44,6 +44,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
readonly maximumWidth: number = DEFAULT_EDITOR_MAX_DIMENSIONS.width;
|
||||
readonly minimumHeight: number = DEFAULT_EDITOR_MIN_DIMENSIONS.height;
|
||||
readonly maximumHeight: number = DEFAULT_EDITOR_MAX_DIMENSIONS.height;
|
||||
readonly onDidChange: Event<{ width: number; height: number; }> = Event.None;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { dispose, Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { dispose, Disposable, IDisposable, empty as EmptyDisposable } from 'vs/base/common/lifecycle';
|
||||
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { Dimension, show, hide, addClass } from 'vs/base/browser/dom';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -43,6 +43,7 @@ export class EditorControl extends Disposable {
|
||||
readonly onDidChange: Event<{ width: number; height: number; }> = this._onDidChange.event;
|
||||
|
||||
private _activeControl: BaseEditor;
|
||||
private activeControlDisposable: IDisposable = EmptyDisposable;
|
||||
private controls: BaseEditor[] = [];
|
||||
|
||||
constructor(
|
||||
@@ -58,7 +59,13 @@ export class EditorControl extends Disposable {
|
||||
}
|
||||
|
||||
private setActiveControl(activeControl: BaseEditor) {
|
||||
this.activeControlDisposable.dispose();
|
||||
this._activeControl = activeControl;
|
||||
|
||||
if (activeControl) {
|
||||
this.activeControlDisposable = activeControl.onDidChange(e => this._onDidChange.fire(e));
|
||||
}
|
||||
|
||||
this._onDidChange.fire();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ export interface IEditor {
|
||||
*/
|
||||
readonly maximumHeight: number;
|
||||
|
||||
/**
|
||||
* An event to notify whenever minimum/maximum width/height changes.
|
||||
*/
|
||||
readonly onDidChange: Event<{ width: number; height: number; }>;
|
||||
|
||||
/**
|
||||
* Returns the unique identifier of this editor.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user