Gutenberg-mobile: After pasting, cursor should move to the end of the pasted content

Created on 5 Apr 2019  路  6Comments  路  Source: wordpress-mobile/gutenberg-mobile

Currently, the keyboard is dismissed but the caret remains at the beginning of the paragraph.

The keyboard should stay visible and the cursor should be at the end of the pasted content

Writing Flow [OS] Android [Type] Bug

All 6 comments

Related PR that may be affecting this issue: https://github.com/wordpress-mobile/gutenberg-mobile/pull/629

Thanks @hypest !

There are a few things going on in this issue that I'd like to separately identify.

  1. When multi-line plain text is pasted, the pasted text _always_ begins in its own (new) paragraph block, even when the clipboard contents do not begin with a \n (newline).
  2. The caret position after paste is not at the end of the pasted text.
  3. The caret position after paste is not in the correct block (the wrong block is active / focused).

Here are some steps to reproduce:

  1. Copy multi-line text to the clipboard (e.g. "Paragraph 1.\n\nParagraph 2.\n").
  2. Place caret at the end of the "Hello World!" block.
  3. Tap the caret handle and paste the content.

Expected result:

  • "Paragraph 1." is appended to the text in the "Hello World!" paragraph block to read: "Hello World!Paragraph 1."
  • A new paragraph block is created below with the text: "Paragraph 2."
  • The new paragraph block is focused / active
  • The caret is in the new paragraph block, at the end: "Paragraph 2.|" (where '|' == caret).

Actual result:

  • Text is not appended to "Hello World!" paragraph block.
  • Two new paragraph blocks are created with the text "Paragraph 1." and "Paragraph 2.", respectively.
  • The first of the new paragraph blocks is focused / active (i.e. the "Paragraph 1." block).
  • The caret is at the beginning of the text: "|Paragraph 1.".

Screencast:

A simpler case of this issue exists for pasting inline content as well.

Here are some steps to reproduce:

  1. Copy inline text to the clipboard (e.g. "Hello World!").
  2. Place caret just before the 'W' in the end of the "Hello World!" block: "Hello |World!".
  3. Tap the caret handle and paste the content.

Expected result:

  • "Hello World!" is inserted at the caret position, so the paragraph block reads: "Hello Hello World!World!".
  • The caret position is after the pasted content: "Hello Hello World!|World!".

Actual result:

  • "Hello World!" is inserted at the caret position, so the paragraph block reads: "Hello Hello World!World!".
  • The caret position is before the pasted content: "Hello |Hello World!World!".

Screencast:

Updated the title to reflect that the issue (caret staying at the start of the pasted text) is not platform specific.

This issue has been resolved, seemingly by a combination of PRs that move selection logic to Gutenberg, and to a "higher level". :tada:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alextheberge picture alextheberge  路  4Comments

chipsnyder picture chipsnyder  路  3Comments

designsimply picture designsimply  路  4Comments

mkevins picture mkevins  路  3Comments

etoledom picture etoledom  路  4Comments