mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-22 05:34:04 +02:00
feat: remove Cube icon component and enhance ActionsMenu with new keyboard shortcuts for toggling actions
This commit is contained in:
parent
a79268d0f7
commit
554943d349
2 changed files with 61 additions and 21 deletions
|
@ -124,7 +124,6 @@ import Bin from "./Icons/Bin.vue";
|
||||||
import Pen from "./Icons/Pen.vue";
|
import Pen from "./Icons/Pen.vue";
|
||||||
import T from "./Icons/T.vue";
|
import T from "./Icons/T.vue";
|
||||||
import Board from "./Icons/Board.vue";
|
import Board from "./Icons/Board.vue";
|
||||||
import Cube from "./Icons/Cube.vue";
|
|
||||||
import Open from "./Icons/Open.vue";
|
import Open from "./Icons/Open.vue";
|
||||||
import Globe from "./Icons/Globe.vue";
|
import Globe from "./Icons/Globe.vue";
|
||||||
import Zip from "./Icons/Zip.vue";
|
import Zip from "./Icons/Zip.vue";
|
||||||
|
@ -149,7 +148,7 @@ const menuRef = ref<HTMLElement | null>(null);
|
||||||
const scrollbarsRef = ref<InstanceType<
|
const scrollbarsRef = ref<InstanceType<
|
||||||
typeof OverlayScrollbarsComponent
|
typeof OverlayScrollbarsComponent
|
||||||
> | null>(null);
|
> | null>(null);
|
||||||
const { handleAction, isProcessing } = useActions();
|
const { handleAction } = useActions();
|
||||||
|
|
||||||
const SCROLL_PADDING = 8;
|
const SCROLL_PADDING = 8;
|
||||||
|
|
||||||
|
@ -177,6 +176,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "close"): void;
|
(e: "close"): void;
|
||||||
|
(e: "toggle"): void;
|
||||||
(e: "action", action: string, item?: HistoryItem): void;
|
(e: "action", action: string, item?: HistoryItem): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ const topActions = computed((): ActionItem[] => [
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} : Cube,
|
} : undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Copy to Clipboard",
|
title: "Copy to Clipboard",
|
||||||
|
@ -502,6 +502,46 @@ const setupKeyboardHandlers = () => {
|
||||||
},
|
},
|
||||||
{ priority: $keyboard.PRIORITY.HIGH }
|
{ 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 = () => {
|
const selectNext = () => {
|
||||||
|
@ -587,6 +627,13 @@ const handleSearchKeydown = (event: KeyboardEvent) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.key.toLowerCase() === "k" && (event.ctrlKey || event.metaKey)) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
emit("toggle");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<template>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14px" height="14px" viewBox="0 0 16 16">
|
|
||||||
<path fill="#E5DFD5" fill-rule="evenodd"
|
|
||||||
d="M13.5 5.475v4.946a1.5 1.5 0 0 1-.973 1.405l-4.777 1.79V7.53zm-.654-1.36a2 2 0 0 0-.175-.103L9.499 2.427a1.5 1.5 0 0 0-1.197-.063l-4.829 1.81q-.12.045-.23.11L7.05 6.185zM2.5 5.59l3.75 1.875v5.984l-2.92-1.46a1.5 1.5 0 0 1-.83-1.342zM1.267 4.343c-.173.38-.267.8-.267 1.236v5.067a3 3 0 0 0 1.658 2.683l3.172 1.586a3 3 0 0 0 2.395.126l4.828-1.811A3 3 0 0 0 15 10.421V5.354a3 3 0 0 0-1.658-2.683L10.17 1.085A3 3 0 0 0 7.775.959L2.947 2.77a3 3 0 0 0-1.48 1.203a.75.75 0 0 0-.2.37"
|
|
||||||
clip-rule="evenodd" />
|
|
||||||
</svg>
|
|
||||||
</template>
|
|
Loading…
Add table
Add a link
Reference in a new issue