Skip to content
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

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

Closed
kkm000 opened this issue Apr 6, 2020 · 1 comment
Labels
[Feature] Paste [Type] Bug An existing feature does not function as intended

Comments

@kkm000
Copy link

kkm000 commented Apr 6, 2020

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:
  1. 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.
  2. 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):

  • OS: Windows 10 x64
  • Browser: Firefox 64-bit
  • Version: 75.0

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)

  • Switch to HTML. Thanks for never adding a keyboard shortcut for this menu item, despite so many user pleas.
  • Add a line break between <pre> and </pre>
  • Paste text into the gap.
  • Remove extraneous line breaks before and after text.

  • Switch back to visual editing by dropping your keyboard, hunting for your mouse and mousing frantically through the dropdown menu. The block is now formatted as expected:

@talldan talldan added [Feature] Paste [Type] Bug An existing feature does not function as intended labels Apr 7, 2020
@paaljoachim
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Paste [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants