mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
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:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user