diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index 0d3053f..627d6e9 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -276,7 +276,7 @@ if (!q || q.startsWith('http://') || q.startsWith('https://') || q.startsWith('mailto:')) return []; return linkSuggestTitles.filter(e => e.title.toLowerCase().includes(q)).slice(0, 8); }); - let textContextMenu = $state<{ x: number; y: number } | null>(null); + let textContextMenu = $state<{ x: number; y: number; submenuLeft: boolean } | null>(null); let tableContextMenu = $state<{ x: number; y: number } | null>(null); let tablePickerOpen = $state(false); let tablePickerHover = $state({ rows: 0, cols: 0 }); @@ -3949,7 +3949,9 @@ if (y + menuHeight > window.innerHeight) y = window.innerHeight - menuHeight - 8; if (x < 4) x = 4; if (y < 4) y = 4; - textContextMenu = { x, y }; + const submenuWidth = 150; + const submenuLeft = x + menuWidth + submenuWidth > window.innerWidth; + textContextMenu = { x, y, submenuLeft }; } function closeTextContextMenu() { @@ -5784,7 +5786,7 @@ {#if ctxHeadingSubmenu} -