You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a long standing issue when pasting into a Slate document where the structure of the first element gets converted to plain text if only part of that first element was selected. It's very common for users to not capture the start of the tree intentionally or unintentionally.
I believe the reason this issue exists is to support the case of just selecting some text and wanting to just paste text rather than the full structure of the original.
This is the underlying issue of many bugs, including but probably not limited to #3320, #4408, #3926, and possibly related to #3469, #4401.
We're having some discussion on whether this is something that belongs in the text transform where it currently lives, or if it should have been handled earlier in the fragment that gets passed in, e.g should we clean up the separation of concerns here or go with the least invasive change possible to get things working to fix various issues.
We're working on a PR which I hope to raise today or tomorrow.
Steps
To reproduce the behavior:
Copy a slate tree without completely selecting the first element, where that first element is a heading, list item, etc.
Paste it into the document
First element pasted is now text inside a paragraph instead of its original structure
Expectation
Copy/paste of non-simple text should preserve the structure and formatting of what was copied/
Environment
Slate Version: 0.65.3
Operating System: all
Browser: all
TypeScript Version: all
The text was updated successfully, but these errors were encountered:
Description
There's a long standing issue when pasting into a Slate document where the structure of the first element gets converted to plain text
if only part of that first element was selected. It's very common for users to not capture the start of the tree intentionally or unintentionally.I believe the reason this issue exists is to support the case of just selecting some text and wanting to just paste text rather than the full structure of the original.
The logic in https://github.com/ianstormtaylor/slate/blob/main/packages/slate/src/transforms/text.ts#L312-L320 is incorrect, or at least it is far too aggressive at treating that first element as text.
This is the underlying issue of many bugs, including but probably not limited to #3320, #4408, #3926, and possibly related to #3469, #4401.
We're having some discussion on whether this is something that belongs in the text transform where it currently lives, or if it should have been handled earlier in the fragment that gets passed in, e.g should we clean up the separation of concerns here or go with the least invasive change possible to get things working to fix various issues.
We're working on a PR which I hope to raise today or tomorrow.
Steps
To reproduce the behavior:
Expectation
Copy/paste of non-simple text should preserve the structure and formatting of what was copied/
Environment
The text was updated successfully, but these errors were encountered: