From aeef53df55d5ce2fa6fb6f673f6eeaa6db73f83c Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Fri, 16 May 2025 14:43:24 +0500 Subject: [PATCH] web: press shift+enter to create note in quick open (#8068) Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- .../command-palette/command-palette-dialog.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/web/src/dialogs/command-palette/command-palette-dialog.tsx b/apps/web/src/dialogs/command-palette/command-palette-dialog.tsx index ecb712dfd..595753a86 100644 --- a/apps/web/src/dialogs/command-palette/command-palette-dialog.tsx +++ b/apps/web/src/dialogs/command-palette/command-palette-dialog.tsx @@ -32,6 +32,7 @@ import Dialog from "../../components/dialog"; import { Cross } from "../../components/icons"; import { CustomScrollbarsVirtualList } from "../../components/list-container"; import { useEditorStore } from "../../stores/editor-store"; +import { useStore as useNoteStore } from "../../stores/note-store"; import { strings } from "@notesnook/intl"; import { isMac } from "../../utils/platform"; import { @@ -119,6 +120,16 @@ export const CommandPaletteDialog = DialogManager.register( if (commands.status !== "fulfilled") return; if (e.key == "Enter") { e.preventDefault(); + + if (e.shiftKey && !props.isCommandMode) { + db.notes.add({ title: query }).then((note) => { + useEditorStore.getState().openSession(note); + useNoteStore.getState().refresh(); + }); + props.onClose(false); + return; + } + const command = commands.value.commands[selected]; if (!command) return; command.action?.(command, { @@ -525,6 +536,10 @@ function getCommandPaletteHelp(isCommandMode: boolean) { key: isMac() ? "⌘⏎" : "Ctrl+⏎", description: strings.openInNewTab() }, + { + key: "Shift+⏎", + description: strings.createNewNote() + }, { key: isMac() ? "⌘K" : "Ctrl+K", description: strings.commandPalette()