From 12d18785d595e84974ab6e991e53445f419cd478 Mon Sep 17 00:00:00 2001 From: AliceJump <2630923991@qq.com> Date: Thu, 8 Oct 2026 14:43:03 +0800 Subject: [PATCH 1/2] fix: wrap frozen VS Code webview API --- media/annotationPanel/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/media/annotationPanel/index.html b/media/annotationPanel/index.html index d568420..6a04c72 100644 --- a/media/annotationPanel/index.html +++ b/media/annotationPanel/index.html @@ -82,7 +82,17 @@

Bounding Box

(() => { const nativeAcquire = window.acquireVsCodeApi; let sharedApi; - window.acquireVsCodeApi = () => sharedApi || (sharedApi = nativeAcquire()); + window.acquireVsCodeApi = () => { + if (!sharedApi) { + const nativeApi = nativeAcquire(); + sharedApi = { + postMessage: (...args) => nativeApi.postMessage(...args), + getState: (...args) => nativeApi.getState(...args), + setState: (...args) => nativeApi.setState(...args), + }; + } + return sharedApi; + }; })(); - + \ No newline at end of file From d37058a96307d2997fc561d37330470df14788c2 Mon Sep 17 00:00:00 2001 From: AliceJump <2630923991@qq.com> Date: Thu, 8 Oct 2026 14:43:37 +0800 Subject: [PATCH 2/2] test: cover frozen VS Code webview API --- scripts/test_annotation_mode_cycle.js | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/test_annotation_mode_cycle.js b/scripts/test_annotation_mode_cycle.js index d2bcafb..8a9e7c7 100644 --- a/scripts/test_annotation_mode_cycle.js +++ b/scripts/test_annotation_mode_cycle.js @@ -7,7 +7,9 @@ const root = path.join(__dirname, '..'); const indexPath = path.join(root, 'media', 'annotationPanel', 'index.html'); const indexHtml = fs.readFileSync(indexPath, 'utf8'); const inlineScripts = [...indexHtml.matchAll(/