提交 8d3a399e 编写于 作者: M Matt Bierner

Strict null work for watermark

上级 c533c849
......@@ -33,7 +33,7 @@ export interface KeybindingLabelOptions {
export class KeybindingLabel {
private domNode: HTMLElement;
private keybinding: ResolvedKeybinding;
private keybinding: ResolvedKeybinding | undefined;
private matches: Matches | undefined;
private didEverRender: boolean;
......@@ -47,7 +47,7 @@ export class KeybindingLabel {
return this.domNode;
}
set(keybinding: ResolvedKeybinding, matches?: Matches) {
set(keybinding: ResolvedKeybinding | undefined, matches?: Matches) {
if (this.didEverRender && this.keybinding === keybinding && KeybindingLabel.areSame(this.matches, matches)) {
return;
}
......
......@@ -146,6 +146,9 @@ export class WatermarkContribution implements IWorkbenchContribution {
private create(): void {
const container = this.partService.getContainer(Parts.EDITOR_PART);
if (!container) {
throw new Error('Could not find container');
}
container.classList.add('has-watermark');
this.watermark = $('.watermark');
......@@ -176,7 +179,10 @@ export class WatermarkContribution implements IWorkbenchContribution {
private destroy(): void {
if (this.watermark) {
this.watermark.remove();
this.partService.getContainer(Parts.EDITOR_PART).classList.remove('has-watermark');
const container = this.partService.getContainer(Parts.EDITOR_PART);
if (container) {
container.classList.remove('has-watermark');
}
this.dispose();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册