Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments

firefox: Refresh highlights after create

Fixes highlighted text not being underlined after a highlight is created
until the page is refreshed.

+15
+9
extension/background/service-worker.js
··· 71 71 return res.json(); 72 72 } 73 73 74 + function refreshTabAnnotations(tabId) { 75 + if (!tabId) return; 76 + chrome.tabs.sendMessage(tabId, { type: "REFRESH_ANNOTATIONS" }).catch(() => { 77 + /* ignore missing content script */ 78 + }); 79 + } 80 + 74 81 async function openAnnotationUI(tabId, windowId) { 75 82 if (hasSidePanel) { 76 83 try { ··· 273 280 selector: selector, 274 281 }); 275 282 showNotification("Margin", "Text highlighted!"); 283 + refreshTabAnnotations(tab.id); 276 284 } catch (err) { 277 285 console.error("Highlight API error:", err); 278 286 if (err?.message === "Not authenticated") { ··· 515 523 color: request.data.color || "yellow", 516 524 }); 517 525 sendResponse({ success: true, data: highlightData }); 526 + refreshTabAnnotations(sender.tab?.id); 518 527 } catch (error) { 519 528 sendResponse({ success: false, error: error.message }); 520 529 }
+6
extension/content/content.js
··· 986 986 return true; 987 987 } 988 988 989 + if (request.type === "REFRESH_ANNOTATIONS") { 990 + fetchAnnotations(); 991 + sendResponse({ success: true }); 992 + return true; 993 + } 994 + 989 995 if (request.type === "UPDATE_OVERLAY_VISIBILITY") { 990 996 if (sidebarHost) { 991 997 sidebarHost.style.display = request.show ? "block" : "none";