diff --git a/web_src/css/features/jupyter.css b/web_src/css/features/jupyter.css index 41274b7782..5d366eb237 100644 --- a/web_src/css/features/jupyter.css +++ b/web_src/css/features/jupyter.css @@ -9,7 +9,6 @@ /* Cell containers */ .jupyter-notebook .cell { margin-bottom: 20px; - overflow: hidden; } /* Markdown cells */ diff --git a/web_src/js/render/plugins/frontend-jupyter-notebook.ts b/web_src/js/render/plugins/frontend-jupyter-notebook.ts index dfaf87aa94..365b41ce51 100644 --- a/web_src/js/render/plugins/frontend-jupyter-notebook.ts +++ b/web_src/js/render/plugins/frontend-jupyter-notebook.ts @@ -2,48 +2,23 @@ import type {FrontendRenderFunc} from '../plugin.ts'; import {marked} from 'marked'; import '../../../css/features/jupyter.css'; -// Sanitize HTML by removing dangerous attributes and elements -function sanitizeHtml(element: HTMLElement) { - const dangerousAttrs = ['onerror', 'onload', 'onclick', 'onmouseover', 'onmouseout', 'onmousemove', - 'onmouseenter', 'onmouseleave', 'onfocus', 'onblur', 'onchange', 'onsubmit', 'onkeydown', - 'onkeyup', 'onkeypress', 'onanimationstart', 'onanimationend', 'onbegin', 'onend', 'onrepeat']; - - const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT); - const nodes: Element[] = []; - let node: Node | null; - while ((node = walker.nextNode())) { - nodes.push(node as Element); - } - - for (const el of nodes) { - // Remove all on* event handlers - for (const attr of dangerousAttrs) { - el.removeAttribute(attr); - } - - // Remove javascript: and data: URLs from href and src - const urlPattern = /^(javascript|data):/; - const href = el.getAttribute('href'); - if (href && urlPattern.test(href.toLowerCase().trim())) { - el.removeAttribute('href'); - } - const src = el.getAttribute('src'); - if (src && urlPattern.test(src.toLowerCase().trim())) { - el.removeAttribute('src'); - } - - // Remove