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

Pasted plain text with line breaks, can't add a list to each line #1727

Closed
qqabcv520 opened this issue Apr 24, 2019 · 11 comments Β· Fixed by ckeditor/ckeditor5-clipboard#64
Closed
Assignees
Labels
type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@qqabcv520
Copy link

Is this a bug report or feature request? (choose one)

Other

πŸ’» Version of CKEditor

12.0.7

πŸ“‹ Steps to reproduce

  1. Copy multiple lines of text
  2. Paste
  3. List command

βœ… Expected result

Add a list to each line

❎ Actual result

Only added to the first line

πŸ“ƒ Other details that might be useful

Inconsistent with Microsoft Word

@Reinmar
Copy link
Member

Reinmar commented Apr 24, 2019

CKEditor 4 also allows turning lines between soft breaks into list items. However, it comes at a cost. This content:

<p>foo<br>bar<br>bom</p>

Will become this after applying the list to a selection placed in "bar":

<p>foo</p>
<ul><li>bar</li></ul>
<p>bom</p>

And after you remove the list, you'll get:

<p>foo</p>
<p>bar</p>
<p>bom</p>

So a different content than the one you started with. But, OTOH, it's the same if the middle line was a heading, so perhaps it's fine.

cc @oleq @scofalik WDYT?

@Reinmar Reinmar added the type:improvement This issue reports a possible enhancement of an existing feature. label Apr 24, 2019
@qqabcv520
Copy link
Author

So how should I use <p>foo</p> replace foo<br> when I paste plain text wraps?

@Reinmar
Copy link
Member

Reinmar commented Apr 29, 2019

So how should I use <p>foo</p> replace foo<br> when I paste plain text wraps?

I'm sorry but I don't understand your question.


I checked that Google Docs behaves like CKEditor 5 – the entire block is converted into list item.

And, MS Word behaves like CKEditor 5 as well. Which means that only CKEditor 4 behaves differently here.

cc @mlewand

@qqabcv520
Copy link
Author

CKEditor: Only added to the first line.

GIF2

Google Docs: Add a list to each line.

GIF3

So how should I Add a list to each line?

@qqabcv520
Copy link
Author

@Reinmar

@scofalik
Copy link
Contributor

Maybe when pasting from Notepad, <br>s are created instead of paragraphs for each line?

@Mgsy
Copy link
Member

Mgsy commented Apr 30, 2019

Google Docs: Add a list to each line.

That's because in this case, Google Docs creates two separate paragraphs after paste. If you try to create a paragraph with a soft brake and apply a list, you'll notice it behaves like CKEditor 5.

bug_cke5

Maybe when pasting from Notepad, <br>s are created instead of paragraphs for each line?

You're right, CKEditor 5 doesn't create a new paragraph for each line pasted from Notepad.

@Reinmar
Copy link
Member

Reinmar commented Apr 30, 2019

So, it's a question whether single line breaks in plain text should create new paragraphs or <br>s. I think we had a discussion about that but I can't find it now.

We should open a new ticket with a better description and close this one. How line breaks are pasted will affect more features (e.g. headings, text alignment, image insertion). I'd be fine with changing the current algorithm and I think it wasn't criticised for the first time

@qqabcv520
Copy link
Author

I think the paste behavior should be the same as the main editor, whether a single line break in plain text should create a new paragraph when pasted, or configurable.

@Reinmar
Copy link
Member

Reinmar commented May 20, 2019

I think the paste behavior should be the same as the main editor

What do you mean by "main editor"?

@qqabcv520
Copy link
Author

qqabcv520 commented May 20, 2019

mainstream editor, popular editor, for example: MS Word, Google Doc. @Reinmar

@Reinmar Reinmar added this to the iteration 25 milestone May 27, 2019
Reinmar added a commit to ckeditor/ckeditor5-clipboard that referenced this issue Jun 26, 2019
Other: New lines pasted as a plain text will always create a new paragraph. Closes ckeditor/ckeditor5#1727.

BREAKING CHANGE: From now on, every new line pasted in the editor as a plain text, will create a new paragraph. Read more at ckeditor/ckeditor5#1727.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants