mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 16:45:53 +02:00
fix(launch_bar): some context menus intercepted by browser
This commit is contained in:
@@ -32,6 +32,9 @@ export function CustomNoteLauncher(props: {
|
||||
onClick={launch}
|
||||
onAuxClick={launch}
|
||||
onContextMenu={async evt => {
|
||||
// Must preventDefault synchronously — awaiting getTargetNoteId first would let the
|
||||
// native browser context menu open before showLauncherContextMenu gets a chance to.
|
||||
evt.preventDefault();
|
||||
const targetNoteId = await getTargetNoteId(launcherNote);
|
||||
const hoistedNoteId = getHoistedNoteId?.(launcherNote) ?? null;
|
||||
const linkItems = targetNoteId ? link_context_menu.getItems(evt) : [];
|
||||
|
||||
@@ -27,6 +27,8 @@ export default function HistoryNavigationButton({ launcherNote, command }: Histo
|
||||
text={title}
|
||||
triggerCommand={command}
|
||||
onContextMenu={async (e) => {
|
||||
// Prevent the native menu synchronously before awaiting history items.
|
||||
e.preventDefault();
|
||||
const items = webContents ? await getHistoryItems(webContents) : [];
|
||||
showLauncherContextMenu<string>(launcherNote, e, {
|
||||
extraItems: items,
|
||||
|
||||
Reference in New Issue
Block a user