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

List block - Pasting Multiline Text - Strange behavior #9476

Closed
dionysous opened this issue Aug 30, 2018 · 12 comments · Fixed by #45016
Closed

List block - Pasting Multiline Text - Strange behavior #9476

dionysous opened this issue Aug 30, 2018 · 12 comments · Fixed by #45016
Assignees
Labels
[Block] List Affects the List Block [Feature] Paste [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@dionysous
Copy link

dionysous commented Aug 30, 2018

Describe the bug

Pasting multiline text from clipboard into list element creates two empty list blocks and a paragraph block in between.

To Reproduce

  1. I have a bit of text (including line breaks), which I copied to clipboard. E.g.:
Lorem ipsum dolor sit amet.
Ipsum dolor sit amet.
Lorem ipsum dolor sit amet.
  1. Then I go to the Gutenberg Editor > Add new Block > Add List Block

  2. I insert the text into the first list element in that block. Instead of being inside the first list element, which is expected from other editors, you get an empty list block, then one paragraph block with the pasted text and under that an empty list block again:

list-block-behavior-pasting

Expected behavior

When pasting the text into the first list element, the text should be in that list element, not in an paragraph block:

list-block-expected-behavior

Desktop used:

  • OS: MacOS Mojave
  • Browser: Google Chrome, Mozilla Firefox, Safari
  • Versions: Latest

Additional context

  • Gutenberg Version 3.6.2
@dionysous dionysous mentioned this issue Aug 30, 2018
13 tasks
@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks labels Aug 31, 2018
@designsimply
Copy link
Member

Tested and confirmed using WordPress 4.9.8 and Gutenberg 3.7.

I think it would be a nice enhancement to remove leading and trailing white space from pasted content within list items, but it would also be good to see what developers working on the project think about that as well.

@mcsf
Copy link
Contributor

mcsf commented Sep 14, 2018

Related: #5727

@mcsf mcsf added [Feature] Paste [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Sep 14, 2018
@designsimply designsimply added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Block] List Affects the List Block [Type] Bug An existing feature does not function as intended and removed [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement. labels Oct 16, 2018
@designsimply
Copy link
Member

Thank you for testing Gutenberg at this stage and for reporting the issue! I am closing this one in favor of #10042 because it has a bit more information and also notes a problem with undo which could be relevant. Both issues are good but I want to keep just one of them open!

@wvega
Copy link

wvega commented Jan 4, 2019

@designsimply should this issue be reopened?

I'm still able to reproduce this issue on the Gutenberg version included with WordPress 5.0.2, but #10042 is now closed as a duplicate of #8882 which no longer mentions the problem that occurs pasting multiline text on a List Block.

@newmedicine
Copy link

@designsimply I am having the same problem - Mojave, 5.0.3.

@dionysous
Copy link
Author

dionysous commented Jun 4, 2019

This issue and the related issue #10042 have both been closed. The problem still exist. It has not been fixed.

It still behaves like this:
GitHub Logo

@codebykat | @designsimply | Can you please re-open this issue? Thank you!

@codebykat
Copy link
Contributor

I tried to reproduce this since folks are pinging me on it for whatever reason (🤷‍♀) and I'm not getting the empty list blocks before and after, though it does replace the selected list block with a paragraph block. I'm not sure if that's the intended behavior -- it would seemingly be better to have it paste into a list block and assume newlines delimit new list items. I'll defer to @designsimply or someone else on the Gutenberg team as to whether this should be re-opened as an enhancement.

@designsimply
Copy link
Member

Re-opening for another review and feedback from Gutenberg developers.

I tested and confirmed I can see the exact same behavior showing in @dionysous's gif when I tested using a site running WordPress 5.2.1 and no active plugins. For reference, I tested with Firefox 67.0 on macOS 10.14.5.

This issue doesn't seem like a duplicate of #8882 to me.

@codebykat I suspect you got a mention since you were the author of the #10042 issue.

@designsimply designsimply reopened this Jun 6, 2019
@designsimply designsimply removed the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Jun 6, 2019
@dionysous
Copy link
Author

I can confirm @designsimply - I've tested it again on my Mac using Safari 12.1.2, Chrome 76.0.3 and Firefox 68.0.2:

Screen capture when pasting the text into a list block:

list-element-wordpress-gutenberg-bug

@ellatrix
Copy link
Member

Hi @dionysous! Thanks for the report.

Could you share what the console is logging for you when you paste?

I'm looking for this:

Screenshot 2019-08-07 at 10 53 18

Please copy the text and paste it in between backticks:

```
content
```

Thank you!

@skorasaurus
Copy link
Member

I'm able to reproduce this on Gutenberg 9.5.2, Firefox 83, Ubuntu.

Pasting from a plain text editor (sublime text), each line of text is its own line:

one, this is a ditty
two, this is for a bug report
three, is two plus one

and in the console:

Received HTML:
 <empty string> 
Received plain text:

 one, this is a ditty
two, this is for a bug report
three, is two plus one 
Processed HTML piece:

 <p>one, this is a ditty<br>two, this is for a bug report<br>three, is two plus one</p>

@darwin370
Copy link

darwin370 commented Feb 14, 2021

Also reproducable in WordPress 5.6.1, Twenty Twenty 1.6, no plugins, Firefox 85.0.2 (64-Bit).

Console:

Received HTML:

 <empty string> rich-text.min.js:2:44525
Received plain text:

 one, this is a ditty
two, this is for a bug report
three, is two plus one rich-text.min.js:2:44568
Processed HTML piece:

 <p>one, this is a ditty<br>two, this is for a bug report<br>three, is two plus one</p> blocks.min.js:3:139223

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block [Feature] Paste [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants