WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Regression in WP5.4: Preformatted block drops leading space and loses characters on paste #21438

Closed kkm000 closed 3 years ago

kkm000 commented 4 years ago

Describe the bug My provider has just upgraded WP to 5.4. Since the upgrade, the Preformatted block loses all leading whitespace and the - characters on paste.

To reproduce

  1. Copy the following text to clipboard
    lotsa_spaces:
    conundrum:
    - foo:
      answer: 42
    - bar:
      question:
  2. Paste the text into any text editor to be sure that the text in clipboard is in fact formatted correctly, to exclude possible corruption when copying from the GitHub page.
  3. In the post editor, add the Preformatted block, and paste text into it.

All whitespace and even the leading - symbols are deleted on paste.

Expected behavior Pasted text keeps whitespace as is and does not lose significant characters on paste.

Screenshots

Desktop (please complete the following information):

Additional context This is a regression; the Gutenberg version that came with the previous latest WP 5.3 did preserve formatting and did not lose characters.

All non-initial whitespace runs in the pasted text are compressed into one space. Also, the leading # characters are removed.

I cannot tell the Gutenberg version. I hope that "The version bundled with WP 5.4" is unambiguous? There is no Gutenberg plugin installed, so I am sure I am using the stock WP 5.4 version. I'll be happy to try anything you would suggest to narrow it better.

Symptoms look like a reoccurrence of the bug #6917, fixed nearly 2 years ago.

Workaround (horrifically inefficient)

paaljoachim commented 3 years ago

I went ahead and tested with WordPress 5.7. Gutenberg plugin version 10.1.1 Twenty Twenty One

Backend:

Screen Shot 2021-03-11 at 20 19 15

Frontend:

Screen Shot 2021-03-11 at 20 19 51

This issue is working in WordPress 5.7. So I will go ahead and close this issue.