Move settings navigation to account menu and add file creation templates

This commit is contained in:
SantaSpeen committed 2026-10-22 16:07:59 +03:00
1 parent 042392f611
commit 54761e4ef2
24 files changed
+591 -165

No files matched your search

+27 -1
View File
@@ -7,7 +7,8 @@
role="menu"
tabindex="-1"
:style="{ top: top + 'px', left: left + 'px' }"
@click="hide"
@click="menuClick"
@click.capture="schedulePosition"
@contextmenu.prevent.stop
@keydown="keyboard"
>
@@ -24,6 +25,30 @@ const contextMenu = ref<HTMLElement | null>(null),
top = ref(0);
let previousFocus: HTMLElement | null = null;
const hide = () => emit("hide");
function menuClick(event: MouseEvent) {
if (
event.target instanceof Element &&
event.target.closest('button[aria-haspopup="menu"]')
)
return;
hide();
}
function position() {
if (!contextMenu.value) return;
const rect = contextMenu.value.getBoundingClientRect();
left.value = Math.max(
8,
Math.min(props.pos.x, window.innerWidth - rect.width - 8)
);
top.value = Math.max(
8,
Math.min(props.pos.y, window.innerHeight - rect.height - 8)
);
}
async function schedulePosition() {
await nextTick();
position();
}
function outside(event: Event) {
if (
event.target instanceof Node &&
@@ -32,6 +57,7 @@ function outside(event: Event) {
hide();
}
function keyboard(event: KeyboardEvent) {
schedulePosition();
const buttons = Array.from(
contextMenu.value?.querySelectorAll<HTMLButtonElement>(
"button:not(:disabled)"