Skip to content

Commit

Permalink
コメント修正と関数の統合
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkfx committed Aug 15, 2024
1 parent 97bd8eb commit d738f95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/components/Dialog/DictionaryManageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
class="word-input"
dense
:disable="uiLocked"
@focus="clearSurfaceInputSelection()"
@blur="setSurface(surface)"
@keydown.enter="yomiFocus"
>
Expand All @@ -154,7 +153,6 @@
dense
:error="!isOnlyHiraOrKana"
:disable="uiLocked"
@focus="clearYomiInputSelection()"
@blur="setYomi(yomi)"
@keydown.enter="setYomiWhenEnter"
>
Expand Down Expand Up @@ -703,7 +701,6 @@ const {
contextMenuHeader: surfaceContextMenuHeader,
contextMenudata: surfaceContextMenudata,
readyForContextMenu: readyForSurfaceContextMenu,
clearInputSelection: clearSurfaceInputSelection,
startContextMenuOperation: startSurfaceContextMenuOperation,
endContextMenuOperation: endSurfaceContextMenuOperation,
} = useRightClickContextMenu(surfaceInput, surface);
Expand All @@ -713,7 +710,6 @@ const {
contextMenuHeader: yomiContextMenuHeader,
contextMenudata: yomiContextMenudata,
readyForContextMenu: readyForYomiContextMenu,
clearInputSelection: clearYomiInputSelection,
startContextMenuOperation: startYomiContextMenuOperation,
endContextMenuOperation: endYomiContextMenuOperation,
} = useRightClickContextMenu(yomiInput, yomi);
Expand Down
17 changes: 8 additions & 9 deletions src/composables/useRightClickContextMenu.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/**
* テキスト編集エリアの右クリック
* 参考実装: https://github.com/VOICEVOX/voicevox/pull/1374/files#diff-444f263f72d4db11fe82c672d5c232eb4c29d29dbc1ffd20e279d586b1b2c180
*/

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 { SelectionHelperForQInput } from "@/helpers/SelectionHelperForQInput";

// テキスト編集エリアの右クリック
// 参考実装: https://github.com/VOICEVOX/voicevox/pull/1374/files#diff-444f263f72d4db11fe82c672d5c232eb4c29d29dbc1ffd20e279d586b1b2c180R371-R379

/**
* コンポーネントの中で呼ばれた <QInput> に対して
* 切り取りやコピー、貼り付けの処理を行う
Expand Down Expand Up @@ -145,16 +147,14 @@ export function useRightClickContextMenu(
);
};

const clearInputSelection = () => {
const startContextMenuOperation = () => {
willFocusOrBlur.value = true;

if (!willFocusOrBlur.value) {
inputSelection.toEmpty();
}
};

const startContextMenuOperation = () => {
willFocusOrBlur.value = true;
};

const endContextMenuOperation = async () => {
await nextTick();
willFocusOrBlur.value = false;
Expand All @@ -165,7 +165,6 @@ export function useRightClickContextMenu(
contextMenuHeader,
contextMenudata,
readyForContextMenu,
clearInputSelection,
startContextMenuOperation,
endContextMenuOperation,
};
Expand Down

0 comments on commit d738f95

Please sign in to comment.