This commit is contained in:
Timothy J. Baek 2024-05-23 00:06:27 -07:00
parent dbd79dab90
commit 344262154d
3 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
console.log(request, sender); console.log(request, sender);
const id = sender.tab.id; const id = sender.tab.id;
if (request.method == "getSelection") { if (request.action == "getSelection") {
chrome.scripting chrome.scripting
.executeScript({ .executeScript({
target: { tabId: id, allFrames: true }, target: { tabId: id, allFrames: true },

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@ export const SpotlightSearch = () => {
setOpen((open) => !open); setOpen((open) => !open);
const response = await chrome.runtime.sendMessage({ const response = await chrome.runtime.sendMessage({
method: "getSelection", action: "getSelection",
}); });
if (response?.data ?? false) { if (response?.data ?? false) {
@ -39,7 +39,7 @@ export const SpotlightSearch = () => {
} }
}; };
document.addEventListener("keydown", down); document.addEventListener("keydown", down, { capture: true });
return () => document.removeEventListener("keydown", down); return () => document.removeEventListener("keydown", down);
}, []); }, []);