-
Notifications
You must be signed in to change notification settings - Fork 345
feat: BaseTextFieldにコンテキストメニューを追加 #2716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sevenc-nanashi
merged 37 commits into
VOICEVOX:main
from
takusea:add-text-field-context-menu
Sep 2, 2025
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
560bd3b
ContextMenu系コンポーネントを追加
takusea 114b769
BaseTextFieldにContextMenuを実装
takusea ca58ccc
ContextMenuを使うQDialogにallowFocusOutside属性を追加
takusea c3cabd5
各操作が出来ないときにdisabledになるように修正
takusea 771a6e0
関数の定義順を整理
takusea 5c0a8c7
propsのshortcutをoptionalに変更
takusea 8f3117d
関数の実装をリファクタリング
takusea 2e6b0b9
slotでContextMenuの項目を拡張できるように
takusea 327d3c2
ContextMenuIconのホバー時のcursorをpointerに変更
takusea 1d57c8e
選択範囲をrefで管理するように変更
takusea 616e46b
ContextMenuを開いている際のTextFieldのスタイルを調整
takusea 3390d66
BaseTextFieldをcontenteditableの実装に変更
takusea 941ec5f
plaintext-onlyのcontenteditableのショートカット動作を修正
takusea d71cfff
BaseTextFieldの内部実装に合うように修正
takusea 1b5ee9b
Merge branch 'VOICEVOX:main' into add-text-field-context-menu
takusea 3b387df
Revert "plaintext-onlyのcontenteditableのショートカット動作を修正"
takusea 589a1c9
plaintext-onlyのcontenteditableのショートカット動作を修正
takusea 976234b
Enter押下時にchangeイベントを発行するように
takusea 5d9a73a
placeholderが表示されるように修正
takusea eccb9a5
[update snapshots]
takusea 0a1cbf3
(スナップショットを更新)
github-actions[bot] e734cbd
[update snapshots]
takusea 4870463
(スナップショットを更新)
github-actions[bot] c5cc301
関数順を整理
takusea 8318713
例外の文を修正
takusea d61b718
restoreSelectionの実行にsetTimeoutを使わないように修正
takusea 22c8d23
空白時のカーソルの位置ズレを修正
takusea b380d6e
コメントを追加
takusea bdf5add
コメントを追加
takusea 0a46e08
innerValueのバインディングをより一般的な記述に変更
takusea 6f67ee8
外部からのmodelの変更が反映されるよう修正
takusea 82f953f
選択範囲の復元時inputのfirstChildがない場合input自体を用いるように変更
takusea 3232c7f
modelがundefinedの状態にならないようデフォルト値を追加
takusea 2d5c2ec
不要な変更をもとに戻す
takusea 0e1d7c9
feat: modelValueの変更のテストを追加
sevenc-nanashi fd31e47
fix: lintが落ちてるのを修正
sevenc-nanashi 88e70a7
fix: TOOD -> TODO
sevenc-nanashi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <template> | ||
| <ContextMenuRoot v-model:open="open"> | ||
| <ContextMenuTrigger asChild> | ||
| <slot /> | ||
| </ContextMenuTrigger> | ||
| <ContextMenuPortal> | ||
| <ContextMenuContent | ||
| class="ContextMenuContent" | ||
| :collisionPadding="8" | ||
| avoidCollisions | ||
| hideWhenDetached | ||
| > | ||
| <slot name="menu" /> | ||
| </ContextMenuContent> | ||
| </ContextMenuPortal> | ||
| </ContextMenuRoot> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { | ||
| ContextMenuContent, | ||
| ContextMenuPortal, | ||
| ContextMenuRoot, | ||
| ContextMenuTrigger, | ||
| } from "reka-ui"; | ||
|
|
||
| const open = defineModel<boolean>("open", { default: false }); | ||
| </script> | ||
|
|
||
| <style lang="scss"> | ||
| @use "@/styles/v2/variables" as vars; | ||
| @use "@/styles/v2/colors" as colors; | ||
|
|
||
| .ContextMenuContent { | ||
| min-width: 240px; | ||
| background-color: colors.$background; | ||
| border-radius: vars.$radius-2; | ||
| overflow: hidden; | ||
| padding: vars.$padding-1; | ||
| border: 1px solid colors.$border; | ||
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); | ||
| z-index: vars.$z-index-dropdown; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <template> | ||
| <ContextMenuItem | ||
| :disabled | ||
| class="ContextMenuItem" | ||
| @select="$emit('select', $event)" | ||
| > | ||
| {{ label }} | ||
| <div class="shortcut">{{ shortcut }}</div> | ||
| </ContextMenuItem> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ContextMenuItem } from "reka-ui"; | ||
|
|
||
| defineProps<{ | ||
| label: string; | ||
| shortcut?: string; | ||
| disabled?: boolean; | ||
| }>(); | ||
|
|
||
| defineEmits<{ | ||
| select: [event: Event]; | ||
| }>(); | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| @use "@/styles/v2/variables" as vars; | ||
| @use "@/styles/v2/colors" as colors; | ||
| @use "@/styles/v2/mixin" as mixin; | ||
|
|
||
| .ContextMenuItem { | ||
| position: relative; | ||
| display: flex; | ||
| align-items: center; | ||
| height: vars.$size-control; | ||
| padding: 0 vars.$padding-1; | ||
| padding-left: vars.$padding-2; | ||
| border-radius: vars.$radius-1; | ||
| color: colors.$display; | ||
| cursor: pointer; | ||
|
|
||
| &[data-disabled] { | ||
| opacity: 0.5; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| &[data-highlighted] { | ||
| background-color: colors.$clear-hovered; | ||
| } | ||
|
|
||
| &:focus-visible { | ||
| @include mixin.on-focus; | ||
| } | ||
| } | ||
|
|
||
| .shortcut { | ||
| margin-left: auto; | ||
| color: colors.$display-sub; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <template> | ||
| <ContextMenuSeparator class="ContextMenuSeparator" /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ContextMenuSeparator } from "reka-ui"; | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| @use "@/styles/v2/variables" as vars; | ||
| @use "@/styles/v2/colors" as colors; | ||
|
|
||
| .ContextMenuSeparator { | ||
| height: 1px; | ||
| background-color: colors.$border; | ||
| margin-block: vars.$padding-1; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 調べてみたけど手っ取り早い方法はなさそうでした!
https://chatgpt.com/share/68b7337d-58bc-8008-9b3f-cb6bdb3caefa
一番下で提案されてる、Story.loaders使う形が一番まだマシそう。
それでもだいぶ手続き大変だけど・・・。