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 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(/