From f25fe274732e98a07e838a97022a4d5da887c1da Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 6 Feb 2024 22:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=AE=A1=E7=90=86=E9=87=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=BB=BA=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/config/index.tsx | 2 +- src/pages/script/index.tsx | 32 +++++++++++++++++++++++++++++++- src/pages/script/renameModal.tsx | 7 ++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/pages/config/index.tsx b/src/pages/config/index.tsx index cafc132d..af82602b 100644 --- a/src/pages/config/index.tsx +++ b/src/pages/config/index.tsx @@ -76,7 +76,7 @@ const Config = () => { }; useHotkeys( - 'meta+s', + 'mod+s', (e) => { updateConfig(); }, diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx index dd882b15..b46954e9 100644 --- a/src/pages/script/index.tsx +++ b/src/pages/script/index.tsx @@ -380,7 +380,7 @@ const Script = () => { }, [treeDom.current, data]); useHotkeys( - 'meta+s', + 'mod+s', (e) => { if (isEditing) { saveFile(); @@ -389,6 +389,36 @@ const Script = () => { { enableOnFormTags: ['textarea'], preventDefault: true }, ); + useHotkeys( + 'mod+d', + (e) => { + if (currentNode.title) { + deleteFile(); + } + }, + { preventDefault: true }, + ); + + useHotkeys( + 'mod+o', + (e) => { + if (!isEditing) { + addFile(); + } + }, + { preventDefault: true }, + ); + + useHotkeys( + 'mod+e', + (e) => { + if (currentNode.title) { + cancelEdit(); + } + }, + { preventDefault: true }, + ); + const action = (key: string | number) => { switch (key) { case 'save': diff --git a/src/pages/script/renameModal.tsx b/src/pages/script/renameModal.tsx index 29b84649..c9bba28d 100644 --- a/src/pages/script/renameModal.tsx +++ b/src/pages/script/renameModal.tsx @@ -62,7 +62,12 @@ const RenameModal = ({ onCancel={() => handleCancel()} confirmLoading={loading} > -
+