web: press shift+enter to create note in quick open (#8068)

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2025-05-16 14:43:24 +05:00
committed by Abdullah Atta
parent 29433c4149
commit aeef53df55

View File

@@ -32,6 +32,7 @@ import Dialog from "../../components/dialog";
import { Cross } from "../../components/icons"; import { Cross } from "../../components/icons";
import { CustomScrollbarsVirtualList } from "../../components/list-container"; import { CustomScrollbarsVirtualList } from "../../components/list-container";
import { useEditorStore } from "../../stores/editor-store"; import { useEditorStore } from "../../stores/editor-store";
import { useStore as useNoteStore } from "../../stores/note-store";
import { strings } from "@notesnook/intl"; import { strings } from "@notesnook/intl";
import { isMac } from "../../utils/platform"; import { isMac } from "../../utils/platform";
import { import {
@@ -119,6 +120,16 @@ export const CommandPaletteDialog = DialogManager.register(
if (commands.status !== "fulfilled") return; if (commands.status !== "fulfilled") return;
if (e.key == "Enter") { if (e.key == "Enter") {
e.preventDefault(); 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]; const command = commands.value.commands[selected];
if (!command) return; if (!command) return;
command.action?.(command, { command.action?.(command, {
@@ -525,6 +536,10 @@ function getCommandPaletteHelp(isCommandMode: boolean) {
key: isMac() ? "⌘⏎" : "Ctrl+⏎", key: isMac() ? "⌘⏎" : "Ctrl+⏎",
description: strings.openInNewTab() description: strings.openInNewTab()
}, },
{
key: "Shift+⏎",
description: strings.createNewNote()
},
{ {
key: isMac() ? "⌘K" : "Ctrl+K", key: isMac() ? "⌘K" : "Ctrl+K",
description: strings.commandPalette() description: strings.commandPalette()