From 1614db54cea8853e07997af8ddc4a3b250bcbf97 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Wed, 21 Feb 2024 13:56:49 +0900 Subject: [PATCH] =?UTF-8?q?[=E3=82=BD=E3=83=B3=E3=82=B0]=20undo=E3=81=A8re?= =?UTF-8?q?do=E3=81=AE=E3=82=B7=E3=83=A7=E3=83=BC=E3=83=88=E3=82=AB?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=82=AD=E3=83=BC=E7=99=BB=E9=8C=B2=20(#1861?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Sing/ToolBar.vue | 30 +++++++++++++++++++++++++----- src/components/Talk/ToolBar.vue | 6 +++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/components/Sing/ToolBar.vue b/src/components/Sing/ToolBar.vue index 26671c2da4..df9fe9d184 100644 --- a/src/components/Sing/ToolBar.vue +++ b/src/components/Sing/ToolBar.vue @@ -136,10 +136,34 @@ import CharacterMenuButton from "@/components/Sing/CharacterMenuButton/MenuButto import { useHotkeyManager } from "@/plugins/hotkeyPlugin"; const store = useStore(); + +const uiLocked = computed(() => store.getters.UI_LOCKED); +const editor = "song"; +const canUndo = computed(() => store.getters.CAN_UNDO(editor)); +const canRedo = computed(() => store.getters.CAN_REDO(editor)); + const { registerHotkeyWithCleanup } = useHotkeyManager(); +registerHotkeyWithCleanup({ + editor, + name: "元に戻す", + callback: () => { + if (!uiLocked.value && canUndo.value) { + undo(); + } + }, +}); +registerHotkeyWithCleanup({ + editor, + name: "やり直す", + callback: () => { + if (!uiLocked.value && canRedo.value) { + redo(); + } + }, +}); registerHotkeyWithCleanup({ - editor: "song", + editor, name: "再生/停止", callback: () => { if (nowPlaying.value) { @@ -150,10 +174,6 @@ registerHotkeyWithCleanup({ }, }); -const editor = "song"; -const canUndo = computed(() => store.getters.CAN_UNDO(editor)); -const canRedo = computed(() => store.getters.CAN_REDO(editor)); - const undo = () => { store.dispatch("UNDO", { editor }); }; diff --git a/src/components/Talk/ToolBar.vue b/src/components/Talk/ToolBar.vue index 80d1b323c3..42449f5e41 100644 --- a/src/components/Talk/ToolBar.vue +++ b/src/components/Talk/ToolBar.vue @@ -54,7 +54,7 @@ const nowPlayingContinuously = computed( const { registerHotkeyWithCleanup } = useHotkeyManager(); registerHotkeyWithCleanup({ - editor: "talk", + editor, name: "元に戻す", callback: () => { if (!uiLocked.value && canUndo.value) { @@ -63,7 +63,7 @@ registerHotkeyWithCleanup({ }, }); registerHotkeyWithCleanup({ - editor: "talk", + editor, name: "やり直す", callback: () => { if (!uiLocked.value && canRedo.value) { @@ -73,7 +73,7 @@ registerHotkeyWithCleanup({ }); registerHotkeyWithCleanup({ - editor: "talk", + editor, name: "連続再生/停止", callback: () => { if (!uiLocked.value) {