Skip to content

Commit

Permalink
ContextMenuをContainer/Presentationに分離する (VOICEVOX#2376)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
sevenc-nanashi and Hiroshiba authored Nov 23, 2024
1 parent 7552ace commit a6a4c21
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
import { computed, ref, watch } from "vue";
import { QInput } from "quasar";
import AudioAccent from "@/components/Talk/AudioAccent.vue";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { useRightClickContextMenu } from "@/composables/useRightClickContextMenu";
import { useStore } from "@/store";
import type { FetchAudioResult } from "@/store/type";
Expand Down
34 changes: 34 additions & 0 deletions src/components/Menu/ContextMenu/Container.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!-- StoreのUI_LOCKEDを参照してContextMenuを表示する -->

<template>
<Presentation ref="contextMenu" :header :menudata :uiLocked />
</template>

<script lang="ts">
export type { ContextMenuItemData } from "./Presentation.vue";
</script>
<script setup lang="ts">
import { computed, useTemplateRef } from "vue";
import type { ComponentExposed } from "vue-component-type-helpers";
import Presentation, { ContextMenuItemData } from "./Presentation.vue";
import { useStore } from "@/store";

defineOptions({
name: "ContextMenu",
});

defineProps<{
header?: string;
menudata: ContextMenuItemData[];
}>();
defineExpose({
hide: () => {
contextMenu.value?.hide();
},
});

const store = useStore();
const uiLocked = computed(() => store.getters.UI_LOCKED);
const contextMenu =
useTemplateRef<ComponentExposed<typeof Presentation>>("contextMenu");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,22 @@
</template>

<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from "vue";
import { onMounted, onUnmounted, ref } from "vue";
import { QMenu } from "quasar";
import MenuItem from "./MenuItem.vue";
import { MenuItemButton, MenuItemSeparator } from "./type";
import { useStore } from "@/store";
import MenuItem from "../MenuItem.vue";
import { MenuItemButton, MenuItemSeparator } from "../type";
defineProps<{
header?: string;
menudata: ContextMenuItemData[];
uiLocked?: boolean;
}>();
defineExpose({
hide: () => {
contextMenu.value?.hide();
},
});
const store = useStore();
const uiLocked = computed(() => store.getters.UI_LOCKED);
const contextMenu = ref<QMenu>();
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sing/PlayheadPositionDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ref, computed } from "vue";
import { useStore } from "@/store";
import ContextMenu, {
ContextMenuItemData,
} from "@/components/Menu/ContextMenu.vue";
} from "@/components/Menu/ContextMenu/Container.vue";
import {
getTimeSignaturePositions,
MeasuresBeats,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sing/ScoreSequencer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ import {
} from "vue";
import ContextMenu, {
ContextMenuItemData,
} from "@/components/Menu/ContextMenu.vue";
} from "@/components/Menu/ContextMenu/Container.vue";
import { NoteId } from "@/type/preload";
import { useStore } from "@/store";
import { Note, SequencerEditTarget } from "@/store/type";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sing/SequencerNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import {
} from "@/sing/viewHelper";
import ContextMenu, {
ContextMenuItemData,
} from "@/components/Menu/ContextMenu.vue";
} from "@/components/Menu/ContextMenu/Container.vue";
const props = defineProps<{
note: Note;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sing/SideBar/TrackItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ import { computed, watchEffect, ref } from "vue";
import CharacterSelectMenu from "@/components/Sing/CharacterMenuButton/CharacterSelectMenu.vue";
import SingerIcon from "@/components/Sing/SingerIcon.vue";
import { useStore } from "@/store";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { shouldPlayTracks } from "@/sing/domain";
import { CharacterInfo, StyleInfo, TrackId } from "@/type/preload";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Talk/AccentPhrase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import { computed, ref } from "vue";
import AudioAccent from "./AudioAccent.vue";
import AudioParameter from "./AudioParameter.vue";
import { MenuItemButton } from "@/components/Menu/type";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { useStore } from "@/store";
import { AudioKey, MoraDataType } from "@/type/preload";
import { Mora } from "@/openapi/models/Mora";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Talk/AudioCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ import { computed, watch, ref, nextTick } from "vue";
import { QInput } from "quasar";
import CharacterButton from "@/components/CharacterButton.vue";
import { MenuItemButton, MenuItemSeparator } from "@/components/Menu/type";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { useStore } from "@/store";
import { AudioKey, SplitTextWhenPasteType, Voice } from "@/type/preload";
import { SelectionHelperForQInput } from "@/helpers/SelectionHelperForQInput";
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useRightClickContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { QInput } from "quasar";
import { ref, Ref, nextTick } from "vue";
import { MenuItemButton, MenuItemSeparator } from "@/components/Menu/type";
import ContextMenu from "@/components/Menu/ContextMenu.vue";
import ContextMenu from "@/components/Menu/ContextMenu/Container.vue";
import { SelectionHelperForQInput } from "@/helpers/SelectionHelperForQInput";

/**
Expand Down

0 comments on commit a6a4c21

Please sign in to comment.