-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Pasting should bring you to end of content, not beginning #5317
Comments
Good catch, totally agree it's sensible you'd go to the last place you pasted from. |
I'd like to work on this if no one else is. |
That would be awesome @Kluny - thanks! |
Noticed this during some user testing—it really interrupted the user's flow. Adding this to the Editor milestone as I think it's an important rough edge to smooth off. |
I came in to leave this issue, but instead I can second it here. I submitted a similar issue for the Boostnote editor a few months ago and a fix was created there. Perhaps it could provide a starting point for a solution? |
Relabeling to bug. I'm not aware of any text field in any software that places the cursor at the beginning of pasted content. |
This is something that could be considered when revising the |
It'd be so awesome to see this resolved. I do a lot of copy/paste and this really throws off my flow. |
Considering technical implementation, there are a handful of ways which pasted content is handled while within a RichText (paragraph) field. Most relevant to the issue is what happens here: gutenberg/packages/editor/src/components/rich-text/index.js Lines 290 to 321 in e969954
There are three routes this can take:
A first thought occurs to me: In the second point, why do we replace with a new paragraph? We could just inherit the same behavior as in the first point, and the caret would be placed correctly. For the last point, whether it's a replacement or a split (which operates by "inserting" blocks), we should consider how to leverage the existing handling for an gutenberg/packages/editor/src/components/block-list/block.js Lines 147 to 163 in 14374e5
The issue here is whether this is safe to infer:
Depending on the answer to these, I could see changes being made either as an effect handler of block replacement and/or in the block selection reducer handling of block insertion. |
Reopening as after #13294 the last block will now be selected, but ideally the caret should be put at the end as well. |
Reported also in #15166 by @QiShaoXuan:
|
In editor triage today, a related issue came up but we noticed this odd behavior as well. |
Proposed a solution in #21755 |
This was fixed in #21755. |
When you paste a couple paragraphs into Gutenberg, your cursor remains at the beginning of the first paragraph you pasted. I expect it to be at the end of the last paragraph pasted.
Example gif:
Related issue:
#6821
The text was updated successfully, but these errors were encountered: