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:
https://github.com/WordPress/gutenberg/issues/6821
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!
Noting that a similar behavior was reported for inline boundaries at #8387 where pasted content at the end of bold text land the content and caret before the inline boundary instead of at the end where the cursor was at the time of pasting. (26s)
Noticed this during some user testing鈥攊t 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 onSplit
prop in #10761.
It'd be so awesome to see this resolved. I do a lot of copy/paste and this really throws off my flow.
Another flow I don't think has been mentioned:
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:
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 initialPosition
value of block selections to move the caret to the end of the new set of blocks:
The issue here is whether this is safe to infer:
updateSelection
parameter for insertBlocks
?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:
When I copy a piece of text into the editor, the cursor always precedes the text, I think it need appear at the end of text.
You can try it in gutenberg website.
@maurisrx:
Yes, I can also confirm that. Every time I copy paste text to new paragraph block, the cursor doesn't automatically move to the end of the text but it stays at the beginning of the text.
@GlennMartin1 :
Same here. Using Chrome on Windows.
In editor triage today, a related issue came up but we noticed this odd behavior as well.
Proposed a solution in https://github.com/WordPress/gutenberg/pull/21755
This was fixed in #21755.
Most helpful comment
It'd be so awesome to see this resolved. I do a lot of copy/paste and this really throws off my flow.