From e75beacb6daaed84204f745663f2af2cfec6dbdf Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Tue, 12 Jul 2022 08:13:29 -0700 Subject: [PATCH] Fix button links on welcome page (#20006) * Fix button links on welcome page * Fix spelling typo --- src/vs/base/browser/dom.ts | 7 ++++--- .../contrib/welcome/walkThrough/browser/walkThroughPart.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index e684e3a625..0e18486962 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -1364,12 +1364,13 @@ export function detectFullscreen(): IDetectedFullscreen | null { /** * Sanitizes the given `value` and reset the given `node` with it. */ -export function safeInnerHtml(node: HTMLElement, value: string): void { +export function safeInnerHtml(node: HTMLElement, value: string, allowUnknownProtocols: boolean = false): void { // {{SQL CARBON EDIT}} - add allow unknown schemas parameter const options: dompurify.Config = { - ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'], - ALLOWED_ATTR: ['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type'], + ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'], // {{SQL CARBON EDIT}} Add i & img tags for welcome page support + ALLOWED_ATTR: ['href', 'data-href', 'data-command', 'target', 'title', 'name', 'src', 'alt', 'class', 'id', 'role', 'tabindex', 'style', 'data-code', 'width', 'height', 'align', 'x-dispatch', 'required', 'checked', 'placeholder', 'type', 'aria-label'], // {{SQL CARBON EDIT}} Add aria-label RETURN_DOM: false, RETURN_DOM_FRAGMENT: false, + ALLOW_UNKNOWN_PROTOCOLS: allowUnknownProtocols }; const allowedProtocols = [Schemas.http, Schemas.https, Schemas.command]; diff --git a/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts index 6dc9db0c7e..1a6ccc4062 100644 --- a/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts +++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts @@ -291,7 +291,7 @@ export class WalkThroughPart extends EditorPane { const content = model.main; if (!input.resource.path.endsWith('.md')) { - safeInnerHtml(this.content, content); + safeInnerHtml(this.content, content, true); // {{SQL CARBON EDIT}} - allow unknown schemas this.updateSizeClasses(); this.decorateContent();