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

Can't paste into void elements #5294

Closed
aspirisen opened this issue Feb 15, 2023 · 6 comments · Fixed by #5305
Closed

Can't paste into void elements #5294

aspirisen opened this issue Feb 15, 2023 · 6 comments · Fixed by #5305
Labels

Comments

@aspirisen
Copy link

Description
Looks like Slate forbids pasting into void elements. However, if you copy slate text and paste into void that works a bit (with runtime errors, but eventually you will see pasted text)

Recording
2023-02-15 16 38 15

Sandbox
https://codesandbox.io/s/confident-orla-7wxwrd?file=/src/App.tsx

Steps
To reproduce the behavior:

  1. Go to sandbox example
  2. Copy some text outside of slate
  3. Paste in input
  4. The text will be not pasted

Expectation
Slate should not forbid pasting into void elements

Environment

  • Slate Version: 0.90.0
  • Operating System: MacOS
  • Browser: Chrome
@keiseiTi
Copy link

keiseiTi commented Feb 21, 2023

@aspirisen
Copy link
Author

Looks like copying from html works
Try to copy i.e. from address bar
2023-02-21 13 54 29

@keiseiTi
Copy link

keiseiTi commented Feb 21, 2023

I know why cannot copy content in input box. Because it's a void element. This is the default rule of slate.
But you know that input box can pasted some text. I guess that is the rule of the browser,but it is inconsistent with the behavior of slate

@aspirisen
Copy link
Author

Yes, it is void element. But it is strange that you can copy-paste from slate content and it will work for void element, but it doesn't work if you copy-paste from plain text source.

@dylans
Copy link
Collaborator

dylans commented Feb 21, 2023

The behavior changed a bit with #5121 but there may be a scenario that is failing.

Please read through the above issue and the PR that landed and see if that answers your question, or let me know if it's still not working for you.

@aspirisen
Copy link
Author

@dylans I do not clear understand expected behavior

  • Is it expected that you can paste into void elements - if yes then disability of plain text pasting into void elements is a bug
  • Is it expected that you can't paste into void elements - if yes then ability of copy-pasting slate content into void element is a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants