Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Support for lists indentation in pasted content added #53

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

f1ames
Copy link
Contributor

@f1ames f1ames commented Feb 18, 2019

Suggested merge commit message (convention)

Feature: Support for lists indentation in pasted content added. Closes ckeditor/ckeditor5#2518.


Additional information

See ckeditor/ckeditor5#2518.

@f1ames f1ames marked this pull request as ready for review February 18, 2019 12:51
@f1ames f1ames requested a review from Reinmar February 18, 2019 12:51
@f1ames
Copy link
Contributor Author

f1ames commented Feb 18, 2019

@Mgsy Could you take a look and test if everything works fine?

@Mgsy Mgsy self-requested a review February 18, 2019 13:19
@coveralls
Copy link

coveralls commented Feb 18, 2019

Pull Request Test Coverage Report for Build 183

  • 41 of 41 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 180: 0.0%
Covered Lines: 206
Relevant Lines: 206

💛 - Coveralls

@Mgsy
Copy link
Member

Mgsy commented Feb 18, 2019

Steps to reproduce

  1. Open Word and create a new list with three items.
  2. Put the caret at the beginning of the second item.
  3. Press Tab twice.
  4. Put the caret at the beginning of the third item.
  5. Press Tab.
  6. Copy the whole list.
  7. Paste it to the editor.

Current result

The second list item has no text and contains the list element.

Screenshot

image

@Mgsy
Copy link
Member

Mgsy commented Feb 18, 2019

Steps to reproduce

  1. Open Word and create an unordered list with 4 items.
  2. Indent the second one.
  3. Make two indentations for the third and the fourth items.
  4. Transform only the third item into the ordered list item.
  5. Copy the whole list.
  6. Paste it to the editor.

Current result

The content is broken.

Screenshot

image

@f1ames
Copy link
Contributor Author

f1ames commented Feb 19, 2019

There is a general problem with compatibility of nested list items between Word and content we can generate in the editor. In Word you could easily create a list items which are nested many levels deep. In the editor the difference in indentation between consecutive list items can be only one level (at least when you upcast view - didn't checked if you can create it by modifying the model itself because it is irrelevant in this case).

For example, list in Word like:

image

can have it's indentation aligned and be represented as:

  • Test1
    • Test2
    • Test3

or the second item can be wrapped in additional list to keep the same indentation level as in Word:

  • Test1
    •  
      • Test2
    • Test3

I went with the second approach to keep the proper indentation, that's why in #53 (comment) there is one empty list element.


The second case (#53 (comment)) is caused by the same mechanism as mentioned above, however there is one more thing going on. In the 4th step:

  1. Transform only the third item into the ordered list item.

Word creates a new list instead of changing bullet type in the same list so you end up with 3 separate lists. And then again, nesting mechanism kicks in which handles the case when first list item has some indentation so it creates this strangely looking lists.


So the above issues mentioned by @Mgsy are in fact intended behaviour, but the question is if we want it to work that way. As mentioned before there are two possible approaches:

Keep the same indentation as in Word by additional nesting

This is how it works now, so indentation will be kept when pasting from Word. This can be achieved by adding additional nesting to pasted lists. And so the transformed content will look like below (left is Word document, right after pasting to the editor):

word-ckeditor

Normalize list indentation

The indentation could be normalized in a way there are no empty lists created, it will look like below (again, left is Word document, right after pasting to the editor):

word-ckeditor2

This approach creates less confusing and more "correctly looking" content, but the indentation is lost in some cases.

WDYT @Mgsy @Reinmar should we normalize indentation here or stay with nesting?

@Mgsy
Copy link
Member

Mgsy commented Feb 19, 2019

WDYT @Mgsy @Reinmar should we normalize indentation here or stay with nesting?

Thanks for the clarification, now I understand what happened. The approach you used makes sense for me, but still isn't something that I expected.

I got in my mind that in the editor I can't create additional nesting as easy as in Word, so I expected that those indents will be normalized. For me, the current output was just confusing and unreadable.

From the other hand, this solution keeps the user's intentions and changing it might be unwanted (but as well as adding additional lists).

Not sure how we should deal with it, but for me, I'll go with normalizing this kind of indents.

@scofalik
Copy link
Contributor

Not that anyone asked about my opinion but I agree with @Mgsy

@Reinmar
Copy link
Member

Reinmar commented Mar 7, 2019

I agree with @Mgsy too. So R- :(

Copy link
Member

@Reinmar Reinmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented – normalization should work differently.

@amrita-syn
Copy link
Contributor

What is the status on this please? Desperately needed.

@laertispappas
Copy link

hey guys any updates on this one?

@Reinmar
Copy link
Member

Reinmar commented Feb 12, 2020

Unfortunately nothing new – we're not working on this PR nor plan to do so. What could help us prioritise it is more 👍 under ckeditor/ckeditor5#2518 because from the current look of things, it's not a very popular feature request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for basic list indentation when pasting from Word
8 participants