提交 fb83608e 编写于 作者: J Johannes Rieken

MarkdownString#enableCommand -> trusted, #29076

上级 17f1fe3a
......@@ -105,7 +105,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: RenderOptions
if (!href || href.match(/^data:|javascript:/i)) {
return text;
} else if (href.match(/^command:/i)) {
return markdown.enableCommands
return markdown.trusted
? `<a href="#" data-href="${href}" title="${localize('hover.command', "Click to execute command")}">${text}&nbsp;<span class="octicon octicon-terminal"></span></a>`
: text;
......
......@@ -10,7 +10,7 @@ import { marked } from 'vs/base/common/marked/marked';
export interface IMarkdownString {
value: string;
enableCommands?: true;
trusted?: true;
}
export class MarkdownString implements IMarkdownString {
......@@ -30,13 +30,13 @@ export class MarkdownString implements IMarkdownString {
return true;
} else if (typeof thing === 'object') {
return typeof (<IMarkdownString>thing).value === 'string'
&& (typeof (<IMarkdownString>thing).enableCommands === 'boolean' || (<IMarkdownString>thing).enableCommands === void 0);
&& (typeof (<IMarkdownString>thing).trusted === 'boolean' || (<IMarkdownString>thing).trusted === void 0);
}
return false;
}
value: string;
enableCommands?: true;
trusted?: true;
constructor(value: string = '') {
this.value = value;
......@@ -78,7 +78,7 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {
} else if (!a || !b) {
return false;
} else {
return a.value === b.value && a.enableCommands === b.enableCommands;
return a.value === b.value && a.trusted === b.trusted;
}
}
......
......@@ -355,7 +355,7 @@ declare module monaco {
}
export interface IMarkdownString {
value: string;
enableCommands?: true;
trusted?: true;
}
export interface IKeyboardEvent {
......
......@@ -147,7 +147,7 @@ function isDecorationOptionsArr(something: vscode.Range[] | vscode.DecorationOpt
export namespace MarkedString {
export function from(markup: vscode.MarkedString): IMarkdownString {
if (typeof markup === 'string' || !markup) {
return { value: <string>markup || '', enableCommands: true };
return { value: <string>markup || '', trusted: true };
} else {
const { language, value } = markup;
return { value: '```' + language + '\n' + value + '\n```' };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册