Skip to content

Commit

Permalink
メニュー、アクセント関連を移動
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkfx committed Dec 3, 2024
1 parent 4298f64 commit 53d2e0b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
32 changes: 25 additions & 7 deletions src/components/Dialog/DictionaryEditWordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,15 @@
</template>

<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { ref } from "vue";
import { QInput } from "quasar";
import AudioAccent from "@/components/Talk/AudioAccent.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { useRightClickContextMenu } from "@/composables/useRightClickContextMenu";
import { useStore } from "@/store";
import type { FetchAudioResult } from "@/store/type";
import { AccentPhrase, UserDictWord } from "@/openapi";
import {
convertHiraToKana,
convertLongVowel,
createKanaRegex,
} from "@/domain/japanese";
const store = useStore();
// 音声再生機構
const nowGenerating = ref(false);
Expand Down Expand Up @@ -219,6 +215,28 @@ const stop = () => {
void store.actions.STOP_AUDIO();
};
// メニュー系
const surfaceInput = ref<QInput>();
const yomiInput = ref<QInput>();
// アクセント系
const changeAccent = async (_: number, accent: number) => {
const { engineId, styleId } = voiceComputed.value;
if (accentPhrase.value) {
accentPhrase.value.accent = accent;
accentPhrase.value = (
await createUILockAction(
store.actions.FETCH_MORA_DATA({
accentPhrases: [accentPhrase.value],
engineId,
styleId,
}),
)
)[0];
}
};
const surfaceContextMenu = ref<InstanceType<typeof ContextMenu>>();
const yomiContextMenu = ref<InstanceType<typeof ContextMenu>>();
Expand Down
21 changes: 0 additions & 21 deletions src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@

<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { QInput } from "quasar";
import DictionaryEditWordDialog from "./DictionaryEditWordDialog.vue";
import { useStore } from "@/store";
import type { FetchAudioResult } from "@/store/type";
import { AccentPhrase, UserDictWord } from "@/openapi";
import {
convertHiraToKana,
Expand Down Expand Up @@ -204,8 +202,6 @@ watch(dictionaryManageDialogOpenedComputed, async (newValue) => {
const wordEditing = ref(false);
const surfaceInput = ref<QInput>();
const yomiInput = ref<QInput>();
const yomiFocus = (event?: KeyboardEvent) => {
if (event && event.isComposing) return;
yomiInput.value?.focus();
Expand Down Expand Up @@ -292,23 +288,6 @@ const setYomi = async (text: string, changeWord?: boolean) => {
yomi.value = text;
};
const changeAccent = async (_: number, accent: number) => {
const { engineId, styleId } = voiceComputed.value;
if (accentPhrase.value) {
accentPhrase.value.accent = accent;
accentPhrase.value = (
await createUILockAction(
store.actions.FETCH_MORA_DATA({
accentPhrases: [accentPhrase.value],
engineId,
styleId,
}),
)
)[0];
}
};
// accent phraseにあるaccentと実際に登録するアクセントには差が生まれる
// アクセントが自動追加される「ガ」に指定されている場合、
// 実際に登録するaccentの値は0となるので、そうなるように処理する
Expand Down

0 comments on commit 53d2e0b

Please sign in to comment.