Skip to content

Commit

Permalink
trusted -> isTrusted, #29076
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Aug 25, 2017
1 parent 27c0793 commit 3ab2688
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/vs/base/browser/htmlContentRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

'use strict';

import { localize } from 'vs/nls';
import * as DOM from 'vs/base/browser/dom';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import { escape } from 'vs/base/common/strings';
Expand Down Expand Up @@ -102,12 +101,13 @@ export function renderMarkdown(markdown: IMarkdownString, options: RenderOptions
}
title = removeMarkdownEscapes(title);
href = removeMarkdownEscapes(href);
if (!href || href.match(/^data:|javascript:/i)) {
if (
!href
|| href.match(/^data:|javascript:/i)
|| (href.match(/^command:/i) && !markdown.isTrusted)
) {
// drop the link
return text;
} else if (href.match(/^command:/i)) {
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;

} else {
return `<a href="#" data-href="${href}" title="${title || text}">${text}</a>`;
Expand Down
8 changes: 4 additions & 4 deletions src/vs/base/common/htmlContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { marked } from 'vs/base/common/marked/marked';

export interface IMarkdownString {
value: string;
trusted?: true;
isTrusted?: boolean;
}

export class MarkdownString implements IMarkdownString {

value: string;
trusted?: true;
isTrusted?: boolean;

constructor(value: string = '') {
this.value = value;
Expand Down Expand Up @@ -58,7 +58,7 @@ export function isMarkdownString(thing: any): thing is IMarkdownString {
return true;
} else if (typeof thing === 'object') {
return typeof (<IMarkdownString>thing).value === 'string'
&& (typeof (<IMarkdownString>thing).trusted === 'boolean' || (<IMarkdownString>thing).trusted === void 0);
&& (typeof (<IMarkdownString>thing).isTrusted === 'boolean' || (<IMarkdownString>thing).isTrusted === void 0);
}
return false;
}
Expand All @@ -83,7 +83,7 @@ function markdownStringEqual(a: IMarkdownString, b: IMarkdownString): boolean {
} else if (!a || !b) {
return false;
} else {
return a.value === b.value && a.trusted === b.trusted;
return a.value === b.value && a.isTrusted === b.isTrusted;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ declare module monaco {
}
export interface IMarkdownString {
value: string;
trusted?: true;
isTrusted?: boolean;
}

export interface IKeyboardEvent {
Expand Down

0 comments on commit 3ab2688

Please sign in to comment.