Skip to content

core: Add copy/paste context menu for EditText #16622

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
merged 8 commits into from
Jun 9, 2024

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Jun 6, 2024

This menu is shown when the EditText is focused and the mouse hovers over it. It has the following elements, which may be disabled when e.g. the field is not editable / selectable:

  • Cut,
  • Copy,
  • Paste,
  • Delete,
  • Select All.

Additionally, this PR also adds handling for an empty clipboard and prevents copy/cut from password fields.

Related to #1891. Fixes #16474.

Desktop Web

@kjarosh kjarosh force-pushed the edittext-context-menu branch 4 times, most recently from 6289034 to c9d30bf Compare June 6, 2024 20:35
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Jun 6, 2024
@kjarosh kjarosh force-pushed the edittext-context-menu branch from c9d30bf to d020f01 Compare June 6, 2024 21:55
@kjarosh
Copy link
Member Author

kjarosh commented Jun 6, 2024

I also noticed that the user should not be able to copy/cut the text from a password text field. So I cleaned up the code a bit to prevent logic duplication, handled this case, and added a test.

@kjarosh kjarosh force-pushed the edittext-context-menu branch 2 times, most recently from 0a229fa to f7289bf Compare June 7, 2024 07:46
Copy link
Contributor

@Dinnerbone Dinnerbone left a comment

Choose a reason for hiding this comment

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

😍

kjarosh added 8 commits June 9, 2024 15:25
This simplifies code, as we do not have to access
the same elements over and over.
This method is useful for checking whether the given text control code
may be applied to the current state of the EditText.
This menu is shown when the EditText is focused and the mouse hovers over it.
It has the following elements, which may be disabled
when e.g. the field is not editable / selectable:
* Cut,
* Copy,
* Paste,
* Delete,
* Select All.
This test verifies how FP behaves when pasting with an empty clipboard.
This test verifies how FP behaves with regard to
copying or cutting text from a password text field.
@Dinnerbone Dinnerbone force-pushed the edittext-context-menu branch from f7289bf to c4bd260 Compare June 9, 2024 13:25
@Dinnerbone Dinnerbone enabled auto-merge (rebase) June 9, 2024 13:26
@Dinnerbone Dinnerbone merged commit f994c69 into ruffle-rs:master Jun 9, 2024
17 checks passed
@kjarosh kjarosh deleted the edittext-context-menu branch June 9, 2024 15:28
@kjarosh kjarosh removed the waiting-on-review Waiting on review from a Ruffle team member label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

The Clockmaker: Context menu copy paste issue
2 participants