Skip to content

Commit 196d3f6

Browse files
committed
Fix Markdown code block editor iframe bootstrap
Use the permitted empty webview bootstrap for nested frames and update @vscode/markdown-editor to 0.0.2-90, which forwards the bootstrap URL to physical iframes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cf6761b4-5164-41c7-8123-5da286a9798a
1 parent aea1715 commit 196d3f6

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎extensions/markdown-language-features/markdown-editor-src/editor.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,14 @@ class Editor extends Disposable {
248248
#createView(host: HTMLElement, content: string): void {
249249
const model = this.model;
250250
const scriptNonce = document.querySelector<HTMLMetaElement>('meta[name="vscode-markdown-editor-script-nonce"]')?.content;
251+
const iframeBootstrapUrl = new URL(location.href);
252+
// Nested frames must use the empty webview bootstrap, not the restricted index.html entrypoint.
253+
iframeBootstrapUrl.pathname = '/fake.html';
251254
const embeddedCodeEditorFactory = this._register(new VirtualizedIframeEmbeddedEditorFactory({
252255
providers: this.#createIframeProviders(this.#codeBlockEditorProviders),
253256
scriptNonce,
254257
themeCss: () => `:root { ${document.documentElement.getAttribute('style') ?? ''} }`,
255-
iframeBootstrapUrl: location.href,
258+
iframeBootstrapUrl: iframeBootstrapUrl.href,
256259
onAmbiguous: (language, providers) => this.#vscode.postMessage({
257260
type: 'codeBlockEditorDiagnostic',
258261
message: `Ambiguous providers for ${language}: ${providers.map(provider => provider.id).join(', ')}`,

‎extensions/markdown-language-features/package-lock.json‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎extensions/markdown-language-features/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@
17911791
},
17921792
"dependencies": {
17931793
"@vscode/extension-telemetry": "^0.9.8",
1794-
"@vscode/markdown-editor": "^0.0.2-88",
1794+
"@vscode/markdown-editor": "^0.0.2-90",
17951795
"@vscode/observables": "^0.1.1-0",
17961796
"dompurify": "^3.4.10",
17971797
"highlight.js": "^11.8.0",

0 commit comments

Comments
 (0)