Skip to content
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

fix: allow copying from editable void input #5369

Merged
merged 1 commit into from
Mar 17, 2023

Conversation

alex-vladut
Copy link
Contributor

Description
Copying from an editable void ends up with the whole void element being copied instead of the selected text only. I added a fix so that, when the target of the event is an input field it won't apply the regular Slate logic for copying and instead will just rely on the default browser's functionality.

You'll notice in the video that there is still a not-ideal use case where, if a section of text is selected from an editable void it still ends up copying the whole element, not just the text. This kind of approach is useful to enable, for example, copying a non-editable void element such as a mention. Let me know please if someone has a better idea of how to better handle it.

Issue
Fixes: #5366

Example

copy-from-editable-void.mov

Context

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: 9cfe24f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dylans dylans merged commit 556a456 into ianstormtaylor:main Mar 17, 2023
@github-actions github-actions bot mentioned this pull request Mar 17, 2023
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.

Cannot Copy Text Inside an Input in a Void Element
2 participants