Fix context menu input field focus handling

This commit is contained in:
Abdo 2025-06-29 05:26:37 +03:00
parent 4e2f7445ba
commit 24913d1a64

View file

@ -89,6 +89,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let contextMenu: ContextMenu; let contextMenu: ContextMenu;
const [onContextMenu, contextMenuItems] = setupContextMenu(); const [onContextMenu, contextMenuItems] = setupContextMenu();
let contextMenuInput: EditingInputAPI | null = null;
function quoteFontFamily(fontFamily: string): string { function quoteFontFamily(fontFamily: string): string {
// generic families (e.g. sans-serif) must not be quoted // generic families (e.g. sans-serif) must not be quoted
@ -1008,6 +1010,7 @@ components and functionality for general note editing.
role="presentation" role="presentation"
bind:this={noteEditor} bind:this={noteEditor}
on:contextmenu={(event) => { on:contextmenu={(event) => {
contextMenuInput = $focusedInput;
onContextMenu(event, api, $focusedInput, contextMenu); onContextMenu(event, api, $focusedInput, contextMenu);
}} }}
on:dragover|preventDefault on:dragover|preventDefault
@ -1196,7 +1199,7 @@ components and functionality for general note editing.
<Item <Item
on:click={() => { on:click={() => {
item.action(); item.action();
$focusedInput?.focus(); contextMenuInput?.focus();
}} }}
> >
{item.label} {item.label}