feat(plugins): add host.copy bridge for plugin clipboard writes
Plugin workbenches run in a sandbox="allow-scripts" iframe with an opaque origin, so every scripted clipboard path (async Clipboard API, offscreen textarea + execCommand) is denied there — plugins could not copy share links to the system clipboard. The bridge now exposes host.copy: the workbench host reuses copyToClipboard (Tauri clipboard-manager on desktop, Web Clipboard with a legacy fallback on web hosts), and the sandbox iframe additionally gets allow="clipboard-write" so engines that honor the delegation can write directly. The dev host matches production: its debug page answers host.copy in the top-level document and its plugin iframes carry the same allow attribute. No new plugin permission is required, so old hosts keep installing new plugins and old plugins simply never call the method.
This commit is contained in:
5 files changed
+112
-2
No files matched your search
@@ -123,6 +123,7 @@ function installBridge(channel) {
|
||||
},
|
||||
openWorkbench: (contributionId, context) => request("host.openWorkbench", { contributionId, context }),
|
||||
openFilesystem: (providerId, context) => request("host.openFilesystem", { providerId, context }),
|
||||
copy: (text) => request("host.copy", { text }),
|
||||
onContext: (fn) => listen("context", fn),
|
||||
onEvent: (fn) => listen("event", fn),
|
||||
onBinary: (fn) => listen("binary", fn),
|
||||
|
||||
Reference in new issue
Block a user