diff --git a/frontend/src/components/ContextMenu.vue b/frontend/src/components/ContextMenu.vue
index e7da68a5..0816c016 100644
--- a/frontend/src/components/ContextMenu.vue
+++ b/frontend/src/components/ContextMenu.vue
@@ -17,7 +17,8 @@
diff --git a/frontend/src/css/context-menu.css b/frontend/src/css/context-menu.css
index 4564f81d..ef29766f 100644
--- a/frontend/src/css/context-menu.css
+++ b/frontend/src/css/context-menu.css
@@ -109,10 +109,13 @@
min-height: 42px;
}
}
-.context-submenu {
- margin: 4px 0 6px 12px;
- padding-inline-start: 8px;
- border-inline-start: 1px solid var(--borderPrimary);
+.context-menu.context-submenu {
+ margin: 0;
+ padding: 6px;
+ border: 1px solid var(--borderPrimary);
+ width: 260px;
+ min-width: 0;
+ z-index: 12001;
}
.create-type-options {
padding: 8px 14px 16px;
diff --git a/frontend/src/utils/__tests__/context-menu.test.ts b/frontend/src/utils/__tests__/context-menu.test.ts
new file mode 100644
index 00000000..a37804e4
--- /dev/null
+++ b/frontend/src/utils/__tests__/context-menu.test.ts
@@ -0,0 +1,31 @@
+import { expect, it } from "vitest";
+import { submenuPosition } from "../context-menu";
+import { iconPath } from "../icons";
+it("opens beside the parent and flips left at the screen edge", () => {
+ const viewport = { width: 1000, height: 700 };
+ expect(
+ submenuPosition({ left: 100, right: 340, top: 80 }, 260, 400, viewport)
+ ).toEqual({ left: 344, top: 80 });
+ expect(
+ submenuPosition({ left: 700, right: 940, top: 80 }, 260, 400, viewport)
+ ).toEqual({ left: 436, top: 80 });
+});
+it("keeps the panel in the viewport near the bottom and on narrow screens", () => {
+ expect(
+ submenuPosition({ left: 100, right: 340, top: 600 }, 260, 400, {
+ width: 1000,
+ height: 700,
+ })
+ ).toEqual({ left: 344, top: 292 });
+ const position = submenuPosition(
+ { left: 8, right: 260, top: -10 },
+ 260,
+ 400,
+ { width: 320, height: 600 }
+ );
+ expect(position).toEqual({ left: 8, top: 8 });
+});
+it("distinguishes rename from editing file contents", () => {
+ expect(iconPath("mode_edit")).not.toEqual(iconPath("edit_note"));
+ expect(iconPath("edit_note")).not.toEqual(iconPath("file"));
+});
diff --git a/frontend/src/utils/context-menu.ts b/frontend/src/utils/context-menu.ts
new file mode 100644
index 00000000..d745aa1a
--- /dev/null
+++ b/frontend/src/utils/context-menu.ts
@@ -0,0 +1,27 @@
+import type { InjectionKey } from "vue";
+export const contextMenuKey: InjectionKey<{ id: string; close: () => void }> =
+ Symbol("context-menu");
+
+export function submenuPosition(
+ parent: { left: number; right: number; top: number },
+ width: number,
+ height: number,
+ viewport: { width: number; height: number }
+) {
+ const gap = 4,
+ margin = 8;
+ const preferred =
+ parent.right + gap + width <= viewport.width - margin
+ ? parent.right + gap
+ : parent.left - gap - width;
+ return {
+ left: Math.max(
+ margin,
+ Math.min(preferred, viewport.width - width - margin)
+ ),
+ top: Math.max(
+ margin,
+ Math.min(parent.top, viewport.height - height - margin)
+ ),
+ };
+}
diff --git a/frontend/src/utils/icons.ts b/frontend/src/utils/icons.ts
index 9d62951b..bf0eab73 100644
--- a/frontend/src/utils/icons.ts
+++ b/frontend/src/utils/icons.ts
@@ -16,6 +16,9 @@ const paths: Record = {
upload: "M12 16V4 m-5 5 5-5 5 5 M4 16v5h16v-5",
trash: "M3 6h18 M9 6V3h6v3 M5 6l1 15h12l1-15 M10 10v7 M14 10v7",
edit: "m15 4 5 5 M4 20l5-1L21 7l-5-5L4 14z",
+ rename: "M3 7h7 M3 12h5 M3 17h7 M13 3h7 M16.5 3v18 M13 21h7",
+ editDocument:
+ "M5 3h9l5 5v3 M14 3v5h5 M5 3v18h6 M8 11h4 M8 15h2 m3 6 1-4 6-6 3 3-6 6z",
copy: "M8 8h12v13H8z M4 16H2V2h13v2",
paste: "M9 4H5v17h14V4h-4 M9 2h6v5H9z M8 11h8 M8 15h8",
cut: "M9 8 20 20 M9 16 20 4 M9 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M9 17a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
@@ -68,7 +71,7 @@ const paths: Record = {
const aliases: Record = {
cloud_off: "warning",
gps_off: "search",
- edit_note: "edit",
+ edit_note: "editDocument",
view_module: "table",
grid_view: "table",
view_list: "menu",
@@ -94,7 +97,7 @@ const aliases: Record = {
cancel: "close",
delete: "trash",
delete_outline: "trash",
- mode_edit: "edit",
+ mode_edit: "rename",
content_copy: "copy",
content_paste: "paste",
content_cut: "cut",
diff --git a/scripts/build-release.ps1 b/scripts/build-release.ps1
index aab03ca5..ffb5aeb9 100644
--- a/scripts/build-release.ps1
+++ b/scripts/build-release.ps1
@@ -1,4 +1,4 @@
-param([string]$Version = '3.0.0-sso.18')
+param([string]$Version = '3.0.0-sso.19')
$ErrorActionPreference = 'Stop'
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
Push-Location $repo
diff --git a/scripts/build-release.sh b/scripts/build-release.sh
index ce47e7c6..4705ecba 100644
--- a/scripts/build-release.sh
+++ b/scripts/build-release.sh
@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
-VERSION="${VERSION:-3.0.0-sso.18}"
+VERSION="${VERSION:-3.0.0-sso.19}"
COMMIT=$(git rev-parse --short HEAD)
(cd frontend && pnpm install --frozen-lockfile && pnpm run build)
mkdir -p build/release/linux-amd64