mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: compose message command
This commit is contained in:
@@ -204,5 +204,23 @@ window.addEventListener("message", (event) => {
|
|||||||
},
|
},
|
||||||
"*",
|
"*",
|
||||||
);
|
);
|
||||||
|
} else if (event.data.type === "triggerKeyboardEvent") {
|
||||||
|
// Handle keyboard event triggering from content script
|
||||||
|
const { key, code, altKey, ctrlKey, metaKey, shiftKey, keyCode } = event.data;
|
||||||
|
|
||||||
|
const keyboardEvent = new KeyboardEvent('keydown', {
|
||||||
|
key,
|
||||||
|
code,
|
||||||
|
keyCode: keyCode || 0,
|
||||||
|
which: keyCode || 0,
|
||||||
|
altKey: altKey || false,
|
||||||
|
ctrlKey: ctrlKey || false,
|
||||||
|
metaKey: metaKey || false,
|
||||||
|
shiftKey: shiftKey || false,
|
||||||
|
bubbles: true,
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
document.dispatchEvent(keyboardEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -326,7 +326,7 @@
|
|||||||
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
{isSelected ? 'bg-zinc-900/5 dark:bg-white/10 text-zinc-900 dark:text-white dark:ring-[1px] dark:shadow' : 'hover:bg-zinc-500/5 dark:hover:bg-white/5 text-zinc-800 dark:text-zinc-200'}"
|
||||||
onclick={() => executeItemAction(staticItem)}
|
onclick={() => executeItemAction(staticItem)}
|
||||||
>
|
>
|
||||||
<div class="flex-none w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-gradient-to-br from-[#FA5D5D] to-[#DC2F30] rounded-md text-white">{staticItem.icon}</div>
|
<div class="flex-none w-8 h-8 text-xl font-IconFamily flex items-center justify-center bg-gradient-to-br {staticItem.category === 'navigation' ? 'from-[#FA5D5D] to-[#DC2F30]' : 'from-[#4FBBFE] to-[#2090F3]'} rounded-md text-white">{staticItem.icon}</div>
|
||||||
<span class="ml-4 text-lg truncate">
|
<span class="ml-4 text-lg truncate">
|
||||||
<HighlightedText text={staticItem.text} term={searchTerm} matches={result.matches} />
|
<HighlightedText text={staticItem.text} term={searchTerm} matches={result.matches} />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ const staticCommands: StaticCommandItem[] = [
|
|||||||
priority: 4,
|
priority: 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "assessments",
|
id: "dashboard",
|
||||||
icon: "\ueac3",
|
icon: "\ueb87",
|
||||||
category: "navigation",
|
category: "navigation",
|
||||||
text: "Assessments",
|
text: "Dashboard",
|
||||||
action: () => {
|
|
||||||
window.location.hash = "?page=/assessments/upcoming";
|
|
||||||
},
|
|
||||||
priority: 4,
|
priority: 4,
|
||||||
|
action: () => {
|
||||||
|
window.location.hash = "?page=/dashboard";
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "toggle-dark-mode",
|
id: "toggle-dark-mode",
|
||||||
@@ -67,6 +67,22 @@ const staticCommands: StaticCommandItem[] = [
|
|||||||
priority: 2,
|
priority: 2,
|
||||||
keywords: ["theme", "appearance"],
|
keywords: ["theme", "appearance"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "compose-message",
|
||||||
|
icon: "\ue924",
|
||||||
|
category: "action",
|
||||||
|
text: "Compose Message",
|
||||||
|
action: () => {
|
||||||
|
window.postMessage({
|
||||||
|
type: "triggerKeyboardEvent",
|
||||||
|
key: 'm',
|
||||||
|
code: 'KeyM',
|
||||||
|
keyCode: 77,
|
||||||
|
altKey: true
|
||||||
|
}, "*");
|
||||||
|
},
|
||||||
|
priority: 4,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user