mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 13:03:42 +01:00
fixes #14760
This commit is contained in:
@@ -43,6 +43,7 @@ import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableEle
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { Position } from 'vs/platform/editor/common/editor';
|
||||
|
||||
function renderBody(body: string): string {
|
||||
return `<!DOCTYPE html>
|
||||
@@ -60,6 +61,7 @@ class NavBar {
|
||||
private _onChange = new Emitter<string>();
|
||||
get onChange(): Event<string> { return this._onChange.event; }
|
||||
|
||||
private currentId: string = null;
|
||||
private actions: Action[];
|
||||
private actionbar: ActionBar;
|
||||
|
||||
@@ -70,12 +72,7 @@ class NavBar {
|
||||
}
|
||||
|
||||
push(id: string, label: string): void {
|
||||
const run = () => {
|
||||
this._onChange.fire(id);
|
||||
this.actions.forEach(a => a.enabled = a.id !== action.id);
|
||||
return TPromise.as(null);
|
||||
};
|
||||
|
||||
const run = () => this._update(id);
|
||||
const action = new Action(id, label, null, true, run);
|
||||
|
||||
this.actions.push(action);
|
||||
@@ -91,6 +88,17 @@ class NavBar {
|
||||
this.actionbar.clear();
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this._update(this.currentId);
|
||||
}
|
||||
|
||||
_update(id: string = this.currentId): TPromise<void> {
|
||||
this.currentId = id;
|
||||
this._onChange.fire(id);
|
||||
this.actions.forEach(a => a.enabled = a.id !== id);
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.actionbar = dispose(this.actionbar);
|
||||
}
|
||||
@@ -288,6 +296,11 @@ export class ExtensionEditor extends BaseEditor {
|
||||
return super.setInput(input, options);
|
||||
}
|
||||
|
||||
changePosition(position: Position): void {
|
||||
this.navbar.update();
|
||||
super.changePosition(position);
|
||||
}
|
||||
|
||||
private onNavbarChange(extension: IExtension, id: string): void {
|
||||
this.contentDisposables = dispose(this.contentDisposables);
|
||||
this.content.innerHTML = '';
|
||||
|
||||
Reference in New Issue
Block a user