diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 65b6eb9f72ec2..c65a61f2e7b09 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -22,6 +22,13 @@ export function clearNode(node: HTMLElement): void { } } +export function trustedInnerHTML(node: Element, value: TrustedHTML): void { + // this is a workaround for innerHTML not allowing for "asymetric" accessors + // see https://github.com/microsoft/vscode/issues/106396#issuecomment-692625393 + // and https://github.com/microsoft/TypeScript/issues/30024 + node.innerHTML = value as unknown as string; +} + export function isInDOM(node: Node | null): boolean { while (node) { if (node === document.body) { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts index 250fbf0c4a7b5..960d7ff87de24 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts @@ -647,7 +647,7 @@ class CodeCellDragImageRenderer { return null; } - editorContainer.innerHTML = richEditorText as unknown as string; + DOM.trustedInnerHTML(editorContainer, richEditorText); return dragImageContainer; }