diff --git a/package-lock.json b/package-lock.json index 63ebdab..1e702ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "behavior3editor", - "version": "1.8.2", + "version": "1.8.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "behavior3editor", - "version": "1.8.2", + "version": "1.8.3", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index f6f4fca..6dd1c09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "behavior3editor", - "version": "1.8.2", + "version": "1.8.3", "main": "dist-electron/main/index.js", "description": "行为树编辑器", "author": "zhandouxiaojiji & codetypes", diff --git a/src/components/workspace.tsx b/src/components/workspace.tsx index ab7c8c4..9b59fab 100644 --- a/src/components/workspace.tsx +++ b/src/components/workspace.tsx @@ -68,13 +68,18 @@ export const Workspace: FC = () => { workspace.save(); }); - useKeyPress(Hotkey.CloseEditor, null, (event) => { + useKeyPress(Hotkey.CloseAllOtherEditors, null, (event) => { event.preventDefault(); + workspace.editors.forEach((editor) => { + if (editor.path !== workspace.editing?.path) { + workspace.close(editor.path); + } + }); }); useKeyPress(Hotkey.CloseEditor, null, (event) => { + event.preventDefault(); if (workspace.editing) { - event.preventDefault(); if (workspace.editing.changed) { showSaveDialog(workspace.editing); } else { diff --git a/src/misc/keys.ts b/src/misc/keys.ts index 18bf9df..9e85de9 100644 --- a/src/misc/keys.ts +++ b/src/misc/keys.ts @@ -29,6 +29,7 @@ export const Hotkey = { Backspace: Key.Backspace, Build: hotkey("ctrl.b"), CloseEditor: hotkey("ctrl.w"), + CloseAllOtherEditors: hotkey("ctrl.shift.w"), Copy: hotkey("ctrl.c"), Cut: hotkey("ctrl.x"), Delete: Key.Delete,