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) {