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 is pasted from OneNote in a reversed order #796

Closed
dryzhkov opened this issue Aug 17, 2017 · 10 comments · Fixed by #863
Closed

List is pasted from OneNote in a reversed order #796

dryzhkov opened this issue Aug 17, 2017 · 10 comments · Fixed by #863
Assignees
Labels
plugin:pastefromword The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Milestone

Comments

@dryzhkov
Copy link

dryzhkov commented Aug 17, 2017

Are you reporting a feature request or a bug?

Bug

Check if the issue is already reported

Put all reference links here…

Provide detailed reproduction steps (if any)

  1. Create a bulleted list in OneNote. Ex:
  • One
  • Two
  • Three
  1. Select all content with ctrl-a
  2. Paste into the latest CKEditor with ctrl-v (Ex: https://ckeditor.com/features)

Expected result

Order should be preserved (One -> Two -> Three)

Actual result

Order is reversed (Three -> Two -> One)

Other details

Note: this seems to happen only if the outer

  • is selected.

    • Browser: Chrome
    • OS: Mac , Windows
    • CKEditor version: 4.7.1+ (Seems to be working in older versions)
    • Installed CKEditor plugins: …
  • @beatadelura beatadelura self-assigned this Aug 18, 2017
    @beatadelura
    Copy link
    Contributor

    @dryzhkov Thank you for creating this issue. Unfortunately, we don't support copy/paste functionality from OneNote, so I have to close this.

    @beatadelura beatadelura added the resolution:wontfix The issue is valid, however, CKSource does not plan to fix it. label Aug 18, 2017
    @WrathOfZombies
    Copy link

    Thanks for the response @beatadelura. Unfortunately this is critical scenario for us and upon debugging further we observed that the reversal happens inside of https://github.com/ckeditor/ckeditor-dev/blob/master/core/htmlparser/fragment.js#L476 which is invoked from https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/pastefromword/filter/default.js#L2167.

    What I am unable to understand is why do we do a reversal of the list and why is it necessary? This is a scenario that's only observed when the HTML dom that's provided to CKEditor looks like follows:

    <ul>
        <!-- Seems that CKEditor creates a fake li here when it doesn't find any children -->
        <ul>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </ul>

    @Stalq
    Copy link

    Stalq commented Aug 29, 2017

    Hello @WrathOfZombies and @dryzhkov. Thank you very much for your message.
    This is Rafal - Head of Sales in CKSource. Most likely the problem with copying/pasting from OneNote is caused by they way how the markup is provided by this application to the browser clipboard. If it happens that it is not consistent with what CKEditor expects then we would need to make a research on this topic. Nevertheless, we are sure that this is not a bug, but rather new feature request. I will reach out to you @WrathOfZombies and @dryzhkov via our support channel. Thanks.

    @mlewand
    Copy link
    Contributor

    mlewand commented Sep 1, 2017

    We don't suport OneNote but let's see how the markup is actually wrong, then based on this we can say what we want to do with it.

    Reopening the issue.

    @mlewand mlewand reopened this Sep 1, 2017
    @mlewand mlewand added support An issue reported by a commercially licensed client. and removed resolution:wontfix The issue is valid, however, CKSource does not plan to fix it. labels Sep 1, 2017
    @jswiderski
    Copy link
    Contributor

    jswiderski commented Sep 1, 2017

    Provide detailed reproduction steps (if any)

    1. Create a 3 element list in OneNote page
    2. While cursor blinks in second or third element use Ctrl + A twice to select the entire list (The first Ctrl + A selects single list item in OneNote)
    3. Press Ctrl + C
    4. Paste into CKEditor with Ctrl + V

    Expected result

    List gets pasted as it was created in OneNote

    Actual result

    List gets pasted with elements in reverse order

    Other details

    • Browser: Chrome, Firefox
    • OS: Win
    • CKEditor version: 4.7.0+ (I could not reproduce this issue in CKEditor 4.6.2 or below)
    • Installed CKEditor plugins: N/A

    I have tested this issue in OneNote 2010 and 2016.


    SIDE NOTE:

    The list pasted from OneNote looks like below:

    <ul style="margin-left:.2847in;direction:ltr;unicode-bidi:embed;margin-top:
     0in;margin-bottom:0in">
     <ul type="disc" style="margin-left:.375in;direction:ltr;unicode-bidi:embed;
      margin-top:0in;margin-bottom:0in">
      <li style="margin-top:0;margin-bottom:0;vertical-align:middle"><span style="font-family:Calibri;font-size:11.0pt">123</span></li>
      <li style="margin-top:0;margin-bottom:0;vertical-align:middle"><span style="font-family:Calibri;font-size:11.0pt">456</span></li>
      <li style="margin-top:0;margin-bottom:0;vertical-align:middle"><span style="font-family:Calibri;font-size:11.0pt">789</span></li>
     </ul>
    </ul>
    

    As you can see there is double UL element what results in the editor as list inside the list element. This result can still be observed in IE11 and Edge while it has gone in Chrome in version 4.7.0 (there is no extra list any more).

    In Firefox till version 4.6.2, list was pasted as image inside paragraph. Starting from version 4.7.0 you get clean HTML but with reversed list items.

    @jswiderski
    Copy link
    Contributor

    OneNoteIssue.zip

    Sample screen-cast

    @msamsel msamsel self-assigned this Sep 4, 2017
    @mlewand
    Copy link
    Contributor

    mlewand commented Sep 4, 2017

    Actually looks that it's a bug on our side @msamsel will elaborate more on that. Bug would be also relevant for Word, so it's a valid one.

    @mlewand mlewand added plugin:pastefromword The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug. labels Sep 4, 2017
    @msamsel
    Copy link
    Contributor

    msamsel commented Sep 4, 2017

    Hi,

    I hope I find the problem.
    There is part of our code which process indent list. In case when unnecessary indention are reduced, children nodes are added to the list always at index 0. So it results with opposite order of list items.
    https://github.com/ckeditor/ckeditor-dev/blob/da389f9f08a8df4562ce14ae02ad215dd510c454/plugins/pastefromword/filter/default.js#L2166-L2168
    I'll prepare pull request which will fix this behaviour.

    @mlewand mlewand added the target:minor Any docs related issue that can be merged into a master or major branch. label Sep 11, 2017
    @mlewand mlewand added this to the Backlog milestone Sep 11, 2017
    @mlewand mlewand changed the title List is copied from OneNote in reversed order List is pasted from OneNote in a reversed order Sep 12, 2017
    @mlewand mlewand modified the milestones: 4.8.0, Backlog Sep 12, 2017
    @mlewand
    Copy link
    Contributor

    mlewand commented Sep 12, 2017

    Fixed by #863.

    @mlewand mlewand closed this as completed Sep 12, 2017
    @WrathOfZombies
    Copy link

    @mlewand Thanks. Testing this out internally and I'll get back in case we have further questions.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    plugin:pastefromword The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
    Projects
    None yet
    Development

    Successfully merging a pull request may close this issue.

    7 participants