mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
@@ -379,6 +379,11 @@ export function handleANSIOutput(text: string): HTMLSpanElement {
|
||||
}
|
||||
}
|
||||
|
||||
const ttPolicy = window.trustedTypes?.createPolicy('notebookRenderer', {
|
||||
createHTML: value => value,
|
||||
createScript: value => value,
|
||||
});
|
||||
|
||||
export function appendStylizedStringToContainer(
|
||||
root: HTMLElement,
|
||||
stringContent: string,
|
||||
@@ -392,7 +397,14 @@ export function appendStylizedStringToContainer(
|
||||
return;
|
||||
}
|
||||
|
||||
const container = linkify(stringContent, true, workspaceFolder);
|
||||
let container = document.createElement('span');
|
||||
const trustedHtml = ttPolicy?.createHTML(stringContent) ?? stringContent;
|
||||
container.innerHTML = trustedHtml as string;
|
||||
|
||||
if (container.childElementCount === 0) {
|
||||
// plain text
|
||||
container = linkify(stringContent, true, workspaceFolder);
|
||||
}
|
||||
|
||||
container.className = cssClasses.join(' ');
|
||||
if (customTextColor) {
|
||||
|
||||
@@ -922,7 +922,7 @@ var requirejs = (function() {
|
||||
if (lineMatch) {
|
||||
const parsedLineNumber = parseInt(lineMatch[1], 10);
|
||||
if (!isNaN(parsedLineNumber)) {
|
||||
lineNumber = parsedLineNumber;
|
||||
lineNumber = parsedLineNumber + 1;
|
||||
column = 1;
|
||||
uri = uri.with({ fragment: `L${lineNumber}` });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user