提交 e88c7bb5 编写于 作者: B Benjamin Pasero

fix an issue where the markdown preview action shows up for non markdown editors

上级 ae59c616
......@@ -59,6 +59,27 @@ class MarkdownFilesActionContributor extends EditorInputActionContributor {
super();
}
/* We override toId() to make the caching of actions based on the mime of the input if given */
protected toId(context: IEditorInputActionContext): string {
let id = super.toId(context);
let mime = this.getMimeFromContext(context);
if (mime) {
id += mime;
}
return id;
}
private getMimeFromContext(context: IEditorInputActionContext): string {
if (context && context.input && context.input instanceof FileEditorInput) {
let fileInput = <FileEditorInput>context.input;
return fileInput.getMime();
}
return null;
}
public hasActionsForEditorInput(context: IEditorInputActionContext): boolean {
const input = context.input;
if (input instanceof FileEditorInput) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册