From 554943d3499e2fcb3aa93d869ecb499ab96fc4db Mon Sep 17 00:00:00 2001 From: pandadev <70103896+0PandaDEV@users.noreply.github.com> Date: Sun, 16 Mar 2025 22:26:53 +0100 Subject: [PATCH] feat: remove Cube icon component and enhance ActionsMenu with new keyboard shortcuts for toggling actions --- components/ActionsMenu.vue | 75 +++++++++++++++++++++++++++++++------- components/Icons/Cube.vue | 7 ---- 2 files changed, 61 insertions(+), 21 deletions(-) delete mode 100644 components/Icons/Cube.vue diff --git a/components/ActionsMenu.vue b/components/ActionsMenu.vue index 4654e27..57d8225 100644 --- a/components/ActionsMenu.vue +++ b/components/ActionsMenu.vue @@ -11,8 +11,8 @@
@@ -34,9 +34,9 @@ selected: isSelected && currentIndex === getActionIndex(index, 'top'), }" :ref="(el) => { - if (currentIndex === getActionIndex(index, 'top')) - setSelectedElement(el); - } + if (currentIndex === getActionIndex(index, 'top')) + setSelectedElement(el); + } ">
@@ -60,9 +60,9 @@ isSelected && currentIndex === getActionIndex(index, 'specific'), }" :ref="(el) => { - if (currentIndex === getActionIndex(index, 'specific')) - setSelectedElement(el); - } + if (currentIndex === getActionIndex(index, 'specific')) + setSelectedElement(el); + } ">
@@ -85,9 +85,9 @@ selected: isSelected && currentIndex === getActionIndex(index, 'bottom'), }" :ref="(el) => { - if (currentIndex === getActionIndex(index, 'bottom')) - setSelectedElement(el); - } + if (currentIndex === getActionIndex(index, 'bottom')) + setSelectedElement(el); + } " :style="action.color ? { color: action.color } : {}">
@@ -124,7 +124,6 @@ import Bin from "./Icons/Bin.vue"; import Pen from "./Icons/Pen.vue"; import T from "./Icons/T.vue"; import Board from "./Icons/Board.vue"; -import Cube from "./Icons/Cube.vue"; import Open from "./Icons/Open.vue"; import Globe from "./Icons/Globe.vue"; import Zip from "./Icons/Zip.vue"; @@ -149,7 +148,7 @@ const menuRef = ref(null); const scrollbarsRef = ref | null>(null); -const { handleAction, isProcessing } = useActions(); +const { handleAction } = useActions(); const SCROLL_PADDING = 8; @@ -177,6 +176,7 @@ const props = defineProps<{ const emit = defineEmits<{ (e: "close"): void; + (e: "toggle"): void; (e: "action", action: string, item?: HistoryItem): void; }>(); @@ -206,7 +206,7 @@ const topActions = computed((): ActionItem[] => [ } }); } - } : Cube, + } : undefined, }, { title: "Copy to Clipboard", @@ -502,6 +502,46 @@ const setupKeyboardHandlers = () => { }, { priority: $keyboard.PRIORITY.HIGH } ); + + $keyboard.on( + "actionsMenu", + [$keyboard.Key.LeftControl, $keyboard.Key.K], + (event) => { + event.preventDefault(); + emit("toggle"); + }, + { priority: $keyboard.PRIORITY.HIGH } + ); + + $keyboard.on( + "actionsMenu", + [$keyboard.Key.RightControl, $keyboard.Key.K], + (event) => { + event.preventDefault(); + emit("toggle"); + }, + { priority: $keyboard.PRIORITY.HIGH } + ); + + $keyboard.on( + "actionsMenu", + [$keyboard.Key.MetaLeft, $keyboard.Key.K], + (event) => { + event.preventDefault(); + emit("toggle"); + }, + { priority: $keyboard.PRIORITY.HIGH } + ); + + $keyboard.on( + "actionsMenu", + [$keyboard.Key.MetaRight, $keyboard.Key.K], + (event) => { + event.preventDefault(); + emit("toggle"); + }, + { priority: $keyboard.PRIORITY.HIGH } + ); }; const selectNext = () => { @@ -586,6 +626,13 @@ const handleSearchKeydown = (event: KeyboardEvent) => { ) { return; } + + if (event.key.toLowerCase() === "k" && (event.ctrlKey || event.metaKey)) { + event.preventDefault(); + event.stopPropagation(); + emit("toggle"); + return; + } event.stopPropagation(); }; diff --git a/components/Icons/Cube.vue b/components/Icons/Cube.vue deleted file mode 100644 index b987711..0000000 --- a/components/Icons/Cube.vue +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file