Skip to content

Commit

Permalink
「内容をテキストのみに適用」をコンテキストメニューに追加 (#1433)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
thiramisu and Hiroshiba authored Jul 31, 2023
1 parent 907eb75 commit 01729f4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/AudioCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ const contextMenudata = ref<
MenuItemButton,
MenuItemButton,
MenuItemSeparator,
MenuItemButton,
MenuItemSeparator,
MenuItemButton
]
>([
Expand Down Expand Up @@ -378,6 +380,21 @@ const contextMenudata = ref<
},
disableWhenUiLocked: true,
},
{ type: "separator" },
{
type: "button",
label: "内容をテキストのみに適用",
onClick: async () => {
contextMenu.value?.hide();
isChangeFlag.value = false;
await store.dispatch("COMMAND_CHANGE_DISPLAY_TEXT", {
audioKey: props.audioKey,
text: audioTextBuffer.value,
});
textfield.value?.blur();
},
disableWhenUiLocked: true,
},
]);
/**
* コンテキストメニューの開閉によりFocusやBlurが発生する可能性のある間は`true`。
Expand Down
13 changes: 13 additions & 0 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,19 @@ export const audioCommandStore = transformCommandStore(
},
},

COMMAND_CHANGE_DISPLAY_TEXT: {
/**
* 読みを変えずにテキストだけを変える
*/
action({ commit }, payload: { audioKey: AudioKey; text: string }) {
commit("COMMAND_CHANGE_AUDIO_TEXT", {
audioKey: payload.audioKey,
text: payload.text,
update: "Text",
});
},
},

COMMAND_CHANGE_AUDIO_TEXT: {
mutation(
draft,
Expand Down
4 changes: 4 additions & 0 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ export type AudioCommandStoreTypes = {
action(payload: { audioKeys: AudioKey[] }): void;
};

COMMAND_CHANGE_DISPLAY_TEXT: {
action(payload: { audioKey: AudioKey; text: string }): void;
};

COMMAND_CHANGE_AUDIO_TEXT: {
mutation: { audioKey: AudioKey; text: string } & (
| { update: "Text" }
Expand Down

0 comments on commit 01729f4

Please sign in to comment.