-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
insertFragment fails on nested blocks #1493
Comments
This might be a stupid question, but what is the expected behavior here? Should it insert the pasted fragment into the quote-block (1), or should it replace the quote with the fragment (2/3)? Let's say I paste the word "Hello", which of these are "correct"? Personally I feel like (1) makes more sense. But maybe there're other situations where that behavior could be problematic? |
I'd expect (1) as that's what every other rich text editor does to my knowledge: paste and match style. Since that's what plain text is: data with no style association, meaning we have to assume some kind of style to it, which is usually derived from the location of paste. |
I think (1) is the most expected. There's a common issue that is when a user triple-clicks, they are usually referring to the idea of "the entire block", but the browser happens to put the focus point at the start of the next. Which explains the Dropbox Paper behavior, even though it's non-obvious. That said, it might be harder to get that working to start, and we could start with the Dropbox Paper behavior if so. |
Most of us expect 1. But why do we delete start block when selection is hanging? slate/packages/slate/src/changes/at-range.js Lines 244 to 250 in fb8075a
IMO, we just need to clean children of start block, and we don't need to delete start block or merge end block. |
See #2746 |
I believe that this may be fixed by #3093, which has changed a lot of the logic in Slate and |
Do you want to request a feature or report a bug?
A bug
What's the current behavior?
As of slate@0.31.7 go to http://slatejs.org/#/rich-text and triple click the quote "A wise quote." to select the whole line, then paste any piece of plain text here. This triggers
insertFragmentAtRange
which failsWhat's the expected behavior?
It should not fail
This makes it hard to paste in code blocks or lists for example, depending on the nested structure your app is using.
The text was updated successfully, but these errors were encountered: