feat(theseus/screenshot): full-tab editor + toolbar-menu + open-tab capabilities
Reworks the screenshot addon into the flow the user asked for: the
dock icon opens a small dropdown menu (Visible viewport / Full page /
Region…) instead of the sidebar picker, and each capture opens a
full browser tab hosting an editor.
Two new addon-host capabilities land alongside:
- toolbar-menu: the addon declares an icon + item list in its manifest;
the chrome dock renders a button that, on click, opens a small menu
and dispatches the selection to the addon via addon-menu-select IPC.
- open-tab: api.openTab(path) opens a browser tab whose URL is the
addon's local file. Origin-gated per addon; the editor uses a
dedicated addon-tab-preload for its main → renderer bridge.
Editor page (editor.html/js/css):
- Crop, arrow, rectangle, circle, freehand pen, text, blur
- Colour swatches (red / yellow / acid / white / black), 3 stroke widths
- Undo/redo command stack, zoom controls
- Save PNG (goes through the download pipeline, chip picks it up)
- Copy to clipboard via ClipboardItem
2026-09-07 00:56:57 +02:00
|
|
|
// Preload for full-tab pages opened by api.openTab("<file>", {query}) — the
|
|
|
|
|
// "open-tab" capability. Same window.silentmode surface as the sidebar
|
|
|
|
|
// preload (storage / invoke / on) but WITHOUT the sidebar's picker strip and
|
|
|
|
|
// resize grip, which have no place in a normal tab. Main derives the add-on
|
|
|
|
|
// identity from the sender's file:// URL, so a page hosted anywhere else
|
|
|
|
|
// gets nothing back from these handlers.
|
|
|
|
|
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
|
contextBridge.exposeInMainWorld("silentmode", {
|
|
|
|
|
storage: {
|
|
|
|
|
get: (key, fallback = null) => ipcRenderer.invoke("addon-storage-get", key, fallback),
|
|
|
|
|
set: (key, value) => ipcRenderer.invoke("addon-storage-set", key, value),
|
|
|
|
|
all: () => ipcRenderer.invoke("addon-storage-all"),
|
|
|
|
|
},
|
|
|
|
|
invoke: (msg, payload) => ipcRenderer.invoke("addon-msg", String(msg), payload),
|
|
|
|
|
on: (msg, cb) => ipcRenderer.on("addon-event", (_e, name, payload) => { if (name === msg) cb(payload); }),
|
2026-09-08 02:27:36 +02:00
|
|
|
// Close the tab this page lives in. Used by editor "Discard" and by
|
|
|
|
|
// Escape. Main derives the tab from the sender's webContents id so an
|
|
|
|
|
// add-on page can only close its own tab, never anyone else's.
|
|
|
|
|
closeTab: () => ipcRenderer.invoke("addon-tab-close"),
|
feat(theseus/screenshot): full-tab editor + toolbar-menu + open-tab capabilities
Reworks the screenshot addon into the flow the user asked for: the
dock icon opens a small dropdown menu (Visible viewport / Full page /
Region…) instead of the sidebar picker, and each capture opens a
full browser tab hosting an editor.
Two new addon-host capabilities land alongside:
- toolbar-menu: the addon declares an icon + item list in its manifest;
the chrome dock renders a button that, on click, opens a small menu
and dispatches the selection to the addon via addon-menu-select IPC.
- open-tab: api.openTab(path) opens a browser tab whose URL is the
addon's local file. Origin-gated per addon; the editor uses a
dedicated addon-tab-preload for its main → renderer bridge.
Editor page (editor.html/js/css):
- Crop, arrow, rectangle, circle, freehand pen, text, blur
- Colour swatches (red / yellow / acid / white / black), 3 stroke widths
- Undo/redo command stack, zoom controls
- Save PNG (goes through the download pipeline, chip picks it up)
- Copy to clipboard via ClipboardItem
2026-09-07 00:56:57 +02:00
|
|
|
});
|