From 53965db74d34671f761c07fc12cf2939e1f9a86c Mon Sep 17 00:00:00 2001 From: Local Dev Date: Tue, 22 Sep 2026 08:34:25 +0200 Subject: [PATCH] feat(addons): let an add-on talk to its own full-tab pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit api.emit() only ever reached the sidebar, even though addon-tab-preload has always exposed silentmode.on() — so an add-on could hear from its panel but had no way to tell its own editor tab anything. An add-on that wants a second document to land in the editor already open, instead of a third tab full of ribbon, needs exactly that. Two small pieces: - emitToPanel now also delivers to every tab owned by the same add-on. The sidebar keeps its existing condition; tabs are additional, not instead. - addon-tab-focus, the counterpart of addon-tab-close: a page asking for its own tab to be fronted. Needed because the click that hands an open page something new usually happens somewhere else — the sidebar — and the result would otherwise appear in a tab nobody is looking at. Both derive the tab from the sender's webContents, the way the close handler already does, so a page can only front or close the tab it is itself in. --- addon-tab-preload.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addon-tab-preload.js b/addon-tab-preload.js index b8a49b1..b3d45e5 100644 --- a/addon-tab-preload.js +++ b/addon-tab-preload.js @@ -17,4 +17,7 @@ contextBridge.exposeInMainWorld("silentmode", { // 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"), + // Bring this page's own tab to the front. Main derives the tab from the + // sender, so a page can only front itself. + focusTab: () => ipcRenderer.invoke("addon-tab-focus"), });