Write on the margins of the internet. Powered by the AT Protocol.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix sidebar not opening

scanash00 3f022b2d 50899d3a

+10 -9
+10 -9
extension/background/service-worker.js
··· 39 39 } 40 40 } 41 41 42 - async function openAnnotationUI(tabId) { 42 + async function openAnnotationUI(tabId, windowId) { 43 43 if (hasSidePanel) { 44 44 try { 45 - const tab = await chrome.tabs.get(tabId); 46 - await chrome.sidePanel.setOptions({ 47 - tabId: tabId, 48 - path: "sidepanel/sidepanel.html", 49 - enabled: true, 50 - }); 51 - await chrome.sidePanel.open({ windowId: tab.windowId }); 45 + let targetWindowId = windowId; 46 + 47 + if (!targetWindowId) { 48 + const tab = await chrome.tabs.get(tabId); 49 + targetWindowId = tab.windowId; 50 + } 51 + 52 + await chrome.sidePanel.open({ windowId: targetWindowId }); 52 53 return true; 53 54 } catch (err) { 54 55 console.error("Could not open Chrome side panel:", err); ··· 117 118 118 119 chrome.contextMenus.onClicked.addListener(async (info, tab) => { 119 120 if (info.menuItemId === "margin-open-sidebar") { 120 - await openAnnotationUI(tab.id); 121 + await openAnnotationUI(tab.id, tab.windowId); 121 122 return; 122 123 } 123 124