Skip to content

Conversation

@takusea
Copy link
Contributor

@takusea takusea commented Jul 19, 2025

内容

BaseTextFieldにコンテキストメニューを追加します。以下の内容を行います。

  • BaseContextMenu・BaseContextMenuItem・BaseContextMenuSeparatorを追加
  • BaseTextFieldにBaseContextMenuを用いたコンテキストメニューを実装
    • 切り取り・コピー・貼り付け・すべて選択の項目を持つようにしています
    • slotで項目を拡張できるようにもしてあります(まだ未使用)
  • BaseTextFieldの内部をinput要素からcontenteditableなdiv要素での実装に変更
    • input要素だとコンテキストメニュー表示中に選択範囲が表示されなくなるため

スクリーンショット・動画など

image

@takusea takusea requested a review from a team as a code owner July 19, 2025 15:45
@takusea takusea requested review from Hiroshiba and removed request for a team July 19, 2025 15:45
@takusea takusea changed the title BaseTextFieldにコンテキストメニューを追加 feat: BaseTextFieldにコンテキストメニューを追加 Jul 19, 2025
@voicevox-preview-pages
Copy link

voicevox-preview-pages bot commented Jul 19, 2025

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:88e70a7

@Hiroshiba Hiroshiba requested a review from sevenc-nanashi July 20, 2025 03:32
@Hiroshiba Hiroshiba requested a review from Copilot July 20, 2025 03:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a context menu system for BaseTextField components, allowing users to access cut, copy, paste, and select all operations via right-click. The implementation also switches from using HTML input elements to contenteditable div elements to better support context menu interactions.

Reviewed Changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
BaseTextField.vue Converted from input element to contenteditable div with custom context menu implementation
BaseContextMenu.vue New reusable context menu wrapper component
BaseContextMenuItem.vue New component for individual context menu items with keyboard shortcuts
BaseContextMenuSeparator.vue New component for visual separators in context menus
hotkeyPlugin.ts Extended hotkey detection to include plaintext-only contenteditable elements
PresetManageDialog.vue Updated to work with new div-based text input and added allowFocusOutside
EngineManageDialog.vue Added allowFocusOutside property for dialog compatibility

Copy link
Member

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

細かいですが:カーソルがズレてそう?

@takusea
Copy link
Contributor Author

takusea commented Aug 2, 2025

image image
細かいですが:カーソルがズレてそう?

間が開いてしまいすみません…!
こちら修正漏れていたので修正しました。

@Hiroshiba
Copy link
Member

@sevenc-nanashi ping

Copy link
Member

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー遅れました、申し訳ないです

const input = getInputOrThrow();
if (input.firstChild == null) {
throw new Error("input.firstChild is null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空の状態で右クリックするとinput.firstChild == nullのブランチに行っちゃうようです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firstChildがない場合にinput自体を用いるように修正しました。

Copy link
Member

@sevenc-nanashi sevenc-nanashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!テストだけ追加してマージします。

@sevenc-nanashi sevenc-nanashi added this pull request to the merge queue Sep 2, 2025
Merged via the queue into VOICEVOX:main with commit 01c9a99 Sep 2, 2025
11 checks passed
Comment on lines +64 to +65
// @ts-expect-error modelValueがreadonlyだが、動いているかつ周りに影響がないため無視する
// TODO: ちゃんとした方法があればそちらに変更する
Copy link
Member

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使う形が一番まだマシそう。
それでもだいぶ手続き大変だけど・・・。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants