gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Classic Block: Can't select multiple lines of text and style them all at once

Open Greatdane opened this issue 2 years ago • 5 comments

Description

When selecting multiple lines of text in a Classic block and then styling it using one of the toolbar options (like Bold, Italic, Alignment options) it only affects the first highlighted word or line.

Step-by-step reproduction instructions

  1. Create a new post
  2. Add a Classic Block
  3. Enter several lines of text separated by a Return
  4. Highlight all of the text
  5. Click the Bold link in the toolbar
  6. Highlight all of the text again
  7. Click the Center Alignment in the toolbar

Screenshots, screen recording, code snippet

I made a video here, but when I made the video, clicking Bold did not bold any of the text at all, so something changed between the time I found the bug originally and the time I created the video to reproduce it!

https://user-images.githubusercontent.com/5075840/165697167-5d523bb6-96d0-4dfc-b10d-56666d4393b3.mp4

Environment info

WordPress 5.9.3 Gutenberg 13.0.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Greatdane avatar Apr 28 '22 07:04 Greatdane

In addition to the styling options, this error also seems to apply when trying to "overwrite" selected text. If you select multiple lines of text and then try to type (in an attempt to replace what was selected with your new text), nothing happens—the selected text is not replaced.

Also, selecting exactly two lines (rather than just one or 3+) causes the selection to disappear entirely, and the caret jumps back to whatever line you had selected last. For example, if I click into the middle of line 2, then select any two lines, the selection immediately vanishes and the insertion point is back in the middle of line 2.

thekingsprojects avatar May 03 '22 17:05 thekingsprojects

Here is a video of quotes not applying to multiple lines. I believe this related to the same issue;

https://user-images.githubusercontent.com/5075840/168214977-1987908b-6fee-42b3-b57a-3634c54dd500.mp4

Greatdane avatar May 13 '22 05:05 Greatdane

  • [ ] Reported here too: #5304320-zd

mriyazuddin avatar Jun 17 '22 04:06 mriyazuddin

5460979-zd

Babylon1999 avatar Aug 08 '22 17:08 Babylon1999

Similar behavior with indentation.

classic-block-indentation.webm

ricjcs avatar Aug 10 '22 16:08 ricjcs

Also, when selecting blocks, you cannot delete them either with backspace button or the delete button.

guten-bug-delete-from-classic-editor.webm

WindowsMod avatar Sep 27 '22 13:09 WindowsMod

This is for for the iframed editors. We should probably do the same for non iframed: alway render the classic editor in a modal.

Screenshot 2023-08-17 at 15 03 29

ellatrix avatar Aug 17 '23 13:08 ellatrix