Merge pull request #112069 from engelsdamien/master
Updates tsec and rewrites sinks assignement
This commit is contained in:
commit
a0cbecb188
10 changed files with 31 additions and 31 deletions
|
@ -169,7 +169,7 @@
|
|||
"source-map": "^0.4.4",
|
||||
"style-loader": "^1.0.0",
|
||||
"ts-loader": "^4.4.2",
|
||||
"tsec": "googleinterns/tsec",
|
||||
"tsec": "googleinterns/tsec#630b53fe2b23815c28dd219119cc98dbd59e29b2",
|
||||
"typescript": "^4.2.0-dev.20201119",
|
||||
"typescript-formatter": "7.1.0",
|
||||
"underscore": "^1.8.2",
|
||||
|
@ -197,4 +197,4 @@
|
|||
"windows-mutex": "0.3.0",
|
||||
"windows-process-tree": "0.2.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1387,7 +1387,7 @@ export function safeInnerHtml(node: HTMLElement, value: string): void {
|
|||
}, ['class', 'id', 'role', 'tabindex']);
|
||||
|
||||
const html = _ttpSafeInnerHtml?.createHTML(value, options) ?? insane(value, options);
|
||||
node.innerHTML = html as unknown as string;
|
||||
node.innerHTML = html as string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -239,7 +239,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
|
|||
const renderedMarkdown = marked.parse(value, markedOptions);
|
||||
|
||||
// sanitize with insane
|
||||
element.innerHTML = sanitizeRenderedMarkdown(markdown, renderedMarkdown);
|
||||
element.innerHTML = sanitizeRenderedMarkdown(markdown, renderedMarkdown) as string;
|
||||
|
||||
// signal that async code blocks can be now be inserted
|
||||
signalInnerHTML!();
|
||||
|
@ -261,13 +261,9 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
|
|||
function sanitizeRenderedMarkdown(
|
||||
options: { isTrusted?: boolean },
|
||||
renderedMarkdown: string,
|
||||
): string {
|
||||
): string | TrustedHTML {
|
||||
const insaneOptions = getInsaneOptions(options);
|
||||
if (_ttpInsane) {
|
||||
return _ttpInsane.createHTML(renderedMarkdown, insaneOptions) as unknown as string;
|
||||
} else {
|
||||
return insane(renderedMarkdown, insaneOptions);
|
||||
}
|
||||
return _ttpInsane?.createHTML(renderedMarkdown, insaneOptions) ?? insane(renderedMarkdown, insaneOptions);
|
||||
}
|
||||
|
||||
function getInsaneOptions(options: { readonly isTrusted?: boolean }): InsaneOptions {
|
||||
|
|
|
@ -88,9 +88,7 @@ export class MarkdownRenderer {
|
|||
|
||||
const element = document.createElement('span');
|
||||
|
||||
element.innerHTML = MarkdownRenderer._ttpTokenizer
|
||||
? MarkdownRenderer._ttpTokenizer.createHTML(value, tokenization) as unknown as string
|
||||
: tokenizeToString(value, tokenization);
|
||||
element.innerHTML = (MarkdownRenderer._ttpTokenizer?.createHTML(value, tokenization) ?? tokenizeToString(value, tokenization)) as string;
|
||||
|
||||
// use "good" font
|
||||
let fontFamily = this._options.codeBlockFontFamily;
|
||||
|
|
|
@ -111,8 +111,8 @@ function createLineBreaks(requests: string[], fontInfo: FontInfo, tabSize: numbe
|
|||
allVisibleColumns[i] = tmp[1];
|
||||
}
|
||||
const html = sb.build();
|
||||
const trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;
|
||||
containerDomNode.innerHTML = trustedhtml as unknown as string;
|
||||
const trustedhtml = ttPolicy?.createHTML(html) ?? html;
|
||||
containerDomNode.innerHTML = trustedhtml as string;
|
||||
|
||||
containerDomNode.style.position = 'absolute';
|
||||
containerDomNode.style.top = '10000';
|
||||
|
|
|
@ -506,15 +506,15 @@ class ViewLayerRenderer<T extends IVisibleLine> {
|
|||
ctx.lines.splice(removeIndex, removeCount);
|
||||
}
|
||||
|
||||
private _finishRenderingNewLines(ctx: IRendererContext<T>, domNodeIsEmpty: boolean, newLinesHTML: string, wasNew: boolean[]): void {
|
||||
private _finishRenderingNewLines(ctx: IRendererContext<T>, domNodeIsEmpty: boolean, newLinesHTML: string | TrustedHTML, wasNew: boolean[]): void {
|
||||
if (ViewLayerRenderer._ttPolicy) {
|
||||
newLinesHTML = ViewLayerRenderer._ttPolicy.createHTML(newLinesHTML) as unknown as string; // explains the ugly casts -> https://github.com/microsoft/vscode/issues/106396#issuecomment-692625393
|
||||
newLinesHTML = ViewLayerRenderer._ttPolicy.createHTML(newLinesHTML as string);
|
||||
}
|
||||
const lastChild = <HTMLElement>this.domNode.lastChild;
|
||||
if (domNodeIsEmpty || !lastChild) {
|
||||
this.domNode.innerHTML = newLinesHTML;
|
||||
this.domNode.innerHTML = newLinesHTML as string; // explains the ugly casts -> https://github.com/microsoft/vscode/issues/106396#issuecomment-692625393;
|
||||
} else {
|
||||
lastChild.insertAdjacentHTML('afterend', newLinesHTML);
|
||||
lastChild.insertAdjacentHTML('afterend', newLinesHTML as string);
|
||||
}
|
||||
|
||||
let currChild = <HTMLElement>this.domNode.lastChild;
|
||||
|
@ -527,13 +527,13 @@ class ViewLayerRenderer<T extends IVisibleLine> {
|
|||
}
|
||||
}
|
||||
|
||||
private _finishRenderingInvalidLines(ctx: IRendererContext<T>, invalidLinesHTML: string, wasInvalid: boolean[]): void {
|
||||
private _finishRenderingInvalidLines(ctx: IRendererContext<T>, invalidLinesHTML: string | TrustedHTML, wasInvalid: boolean[]): void {
|
||||
const hugeDomNode = document.createElement('div');
|
||||
|
||||
if (ViewLayerRenderer._ttPolicy) {
|
||||
invalidLinesHTML = ViewLayerRenderer._ttPolicy.createHTML(invalidLinesHTML) as unknown as string;
|
||||
invalidLinesHTML = ViewLayerRenderer._ttPolicy.createHTML(invalidLinesHTML as string);
|
||||
}
|
||||
hugeDomNode.innerHTML = invalidLinesHTML;
|
||||
hugeDomNode.innerHTML = invalidLinesHTML as string;
|
||||
|
||||
for (let i = 0; i < ctx.linesLength; i++) {
|
||||
const line = ctx.lines[i];
|
||||
|
|
|
@ -2370,7 +2370,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
|||
|
||||
const html = sb.build();
|
||||
const trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;
|
||||
domNode.innerHTML = trustedhtml as unknown as string;
|
||||
domNode.innerHTML = trustedhtml as string;
|
||||
viewZone.minWidthInPx = (maxCharsPerLine * typicalHalfwidthCharacterWidth);
|
||||
|
||||
if (viewLineCounts) {
|
||||
|
|
|
@ -42,8 +42,8 @@ export class Colorizer {
|
|||
let text = domNode.firstChild ? domNode.firstChild.nodeValue : '';
|
||||
domNode.className += ' ' + theme;
|
||||
let render = (str: string) => {
|
||||
const trustedhtml = ttPolicy ? ttPolicy.createHTML(str) : str;
|
||||
domNode.innerHTML = trustedhtml as unknown as string;
|
||||
const trustedhtml = ttPolicy?.createHTML(str) ?? str;
|
||||
domNode.innerHTML = trustedhtml as string;
|
||||
};
|
||||
return this.colorize(modeService, text || '', mimeType, options).then(render, (err) => console.error(err));
|
||||
}
|
||||
|
|
|
@ -594,7 +594,7 @@ class EditorTextRenderer {
|
|||
const element = DOM.$('div', { style });
|
||||
|
||||
const linesHtml = this.getRichTextLinesAsHtml(model, modelRange, colorMap);
|
||||
element.innerHTML = linesHtml as unknown as string;
|
||||
element.innerHTML = linesHtml as string;
|
||||
return element;
|
||||
}
|
||||
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -288,9 +288,9 @@
|
|||
integrity sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==
|
||||
|
||||
"@types/node@^13.13.5":
|
||||
version "13.13.28"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.28.tgz#b6d0628b0371d6c629d729c98322de314b640219"
|
||||
integrity sha512-EM/qFeRH8ZCD+TlsaIPULyyFm9vOhFIvgskY2JmHbEsWsOPgN+rtjSXrcHGgJpob4Nu17VfO95FKewr0XY7iOQ==
|
||||
version "13.13.34"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.34.tgz#c9300a1b6560d90817fb2bba650e250116a575f9"
|
||||
integrity sha512-g8D1HF2dMDKYSDl5+79izRwRgNPsSynmWMbj50mj7GZ0b7Lv4p8EmZjbo3h0h+6iLr6YmVz9VnF6XVZ3O6V1Ug==
|
||||
|
||||
"@types/semver@^5.4.0", "@types/semver@^5.5.0":
|
||||
version "5.5.0"
|
||||
|
@ -9520,11 +9520,12 @@ ts-loader@^4.4.2:
|
|||
micromatch "^3.1.4"
|
||||
semver "^5.0.1"
|
||||
|
||||
tsec@googleinterns/tsec:
|
||||
tsec@googleinterns/tsec#630b53fe2b23815c28dd219119cc98dbd59e29b2:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/googleinterns/tsec/tar.gz/bec3c527789daa9151be2bc8471cfefa4f44d167"
|
||||
resolved "https://codeload.github.com/googleinterns/tsec/tar.gz/630b53fe2b23815c28dd219119cc98dbd59e29b2"
|
||||
dependencies:
|
||||
"@types/node" "^13.13.5"
|
||||
typescript "^3.9.2"
|
||||
|
||||
tslib@^1.8.1, tslib@^1.9.0:
|
||||
version "1.9.3"
|
||||
|
@ -9603,6 +9604,11 @@ typescript@^2.6.2:
|
|||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4"
|
||||
integrity sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=
|
||||
|
||||
typescript@^3.9.2:
|
||||
version "3.9.7"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
|
||||
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
|
||||
|
||||
typescript@^4.2.0-dev.20201119:
|
||||
version "4.2.0-dev.20201119"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.0-dev.20201119.tgz#d4a43511cd9931adac05e1a47b6425f6b0e76cc3"
|
||||
|
|
Loading…
Reference in a new issue