Fix button links on welcome page (#20006)

* Fix button links on welcome page

* Fix spelling typo
This commit is contained in:
Karl Burtram
2022-07-12 08:13:29 -07:00
committed by GitHub
parent 6eda44f828
commit e75beacb6d
2 changed files with 5 additions and 4 deletions

View File

@@ -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];

View File

@@ -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();