Update action run return type (#15568)

* Update action run return type

* fix tests

* Update rest

* Add back null checks
This commit is contained in:
Charles Gagnon
2021-05-25 14:52:39 -07:00
committed by GitHub
parent 25352fa39c
commit 399406b732
29 changed files with 379 additions and 637 deletions

View File

@@ -31,14 +31,13 @@ export class TransformMarkdownAction extends Action {
super(id, label, cssClass);
this._tooltip = tooltip;
}
public async run(context: any): Promise<boolean> {
public async run(context: any): Promise<void> {
if (!context?.cellModel?.showMarkdown && context?.cellModel?.showPreview) {
this.transformDocumentCommand();
} else {
let markdownTextTransformer = new MarkdownTextTransformer(this._notebookService, this._cellModel);
await markdownTextTransformer.transformText(this._type);
}
return true;
}
private transformDocumentCommand() {
@@ -607,7 +606,7 @@ export class ToggleViewAction extends Action {
this._tooltip = tooltip;
}
public async run(context: MarkdownToolbarComponent): Promise<boolean> {
public async run(context: MarkdownToolbarComponent): Promise<void> {
context.removeActiveClassFromModeActions();
this.class += ' active';
context.cellModel.showPreview = this.showPreview;
@@ -618,6 +617,5 @@ export class ToggleViewAction extends Action {
} else {
context.showLinkAndImageButtons();
}
return true;
}
}