fixed toolbar update logic

This commit is contained in:
2026-01-18 12:12:55 -05:00
parent 1e00372140
commit 3f51053ff6
2 changed files with 12 additions and 2 deletions

View File

@@ -459,7 +459,12 @@ function createToolbar(shortcuts, position = "bottom-right", themeMode = "light"
box-shadow: 0 8px 20px ${tokens.glow}; box-shadow: 0 8px 20px ${tokens.glow};
`; `;
btn.addEventListener("click", () => { btn.addEventListener("click", () => {
chrome.runtime.sendMessage({ type: "RUN_SHORTCUT", shortcutId: shortcut.id }); chrome.runtime.sendMessage(
{ type: "RUN_SHORTCUT", shortcutId: shortcut.id },
() => {
void chrome.runtime.lastError;
}
);
}); });
toolbar.appendChild(btn); toolbar.appendChild(btn);
} }
@@ -571,6 +576,11 @@ const observer = new MutationObserver(() => {
observer.observe(document.documentElement, { childList: true, subtree: true }); observer.observe(document.documentElement, { childList: true, subtree: true });
chrome.storage.onChanged.addListener(() => {
if (suppressObserver) return;
scheduleToolbarRefresh();
});
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => { chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
if (!message || typeof message !== "object") return; if (!message || typeof message !== "object") return;
if (message.type === "FIND_SCOPE") { if (message.type === "FIND_SCOPE") {

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "SiteCompanion", "name": "SiteCompanion",
"version": "0.4.2", "version": "0.4.3",
"description": "AI companion for site-bound text extraction and tasks.", "description": "AI companion for site-bound text extraction and tasks.",
"permissions": ["storage", "activeTab"], "permissions": ["storage", "activeTab"],
"host_permissions": ["<all_urls>"], "host_permissions": ["<all_urls>"],