ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Separate lists pasted from Microsoft Office merge into a single list / Faulty list continuation detection

Open jbalinski opened this issue 11 months ago • 7 comments

📝 Provide detailed reproduction steps (if any)

  1. Create a list in outlook that looks something like this: Image
  2. Copy and paste the list into the CKEditor
  3. Notice that all the separate lists are merged into one single list. Image

Here is the raw content that is pasted in from the clipboard: multi list paste content.txt

✔️ Expected result

Lists shouldn't be merged.

❌ Actual result

Lists are inappropriately merged.

❓ Possible solution

This appears to be caused by code in ckeditor5-paste-from-office\src\filters\list.js. The isListContinuation function is inappropriately treating all LI elements as members of the same list.

📃 Other details

  • Browser: Chrome 133
  • OS: Windows 11
  • First affected CKEditor version: Unknown
  • Installed CKEditor plugins: PasteFromOffice

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

jbalinski avatar Feb 27 '25 22:02 jbalinski

Note, this can be reproduced on the public CKEditor 5 demo sites.

jbalinski avatar Feb 27 '25 22:02 jbalinski

Thanks for the report, could you name the Outlook version you are testing?

Witoso avatar Feb 28 '25 07:02 Witoso

Microsoft® Outlook® for Microsoft 365 MSO (Version 2412 Build 16.0.18324.20240) 64-bit

I'm hesitant to share this because it seems quite fragile, but I have some code in place that does address the issue without breaking the changes put in place to address issue #15964. But I'll include it here in case it helps as a starting point:

/**
 * Whether the given element is possibly a list continuation. Previous element was wrapped into a list
 * or the current element already is inside a list.
 */
function isListContinuation(currentItem) {
    const previousSibling = currentItem.element.previousSibling;
    if (!previousSibling) {
        // If it's a li inside ul or ol like in here: https://github.com/ckeditor/ckeditor5/issues/15964.
	let parent = currentItem.element.parent;
        return isList(parent) && isList(parent.parent);
    }
    // Even with the same id the list does not have to be continuous (#43).
    return isList(previousSibling);
}
function isList(element) {
	if(!element)
	{
		return false;
	}
    return element.is('element', 'ol') || element.is('element', 'ul');
}

jbalinski avatar Feb 28 '25 15:02 jbalinski

@Witoso, can you add the support tag to this issue since we are commercially licensed?

jbalinski avatar Mar 04 '25 15:03 jbalinski

Please contact our support, there's a process of labeling tickets as well attaching companies to inform them about resolution via that channel.

Witoso avatar Mar 05 '25 11:03 Witoso

Im also having this issue

jr-cobweb avatar May 22 '25 09:05 jr-cobweb

@Witoso could you please share the estimates when the fix is planned to be released? We're also having this issue (we're commercially licensed).

maryia-kabash avatar Jun 18 '25 07:06 maryia-kabash

I checked it on Firefox 138 with recent master and:

  1. Microsoft Outlook New 1.2024.1126.100 (client version 20250620014.12).
  2. Microsoft Outlook Classic 2021

and it works fine.

Mati365 avatar Jun 30 '25 06:06 Mati365

In my case, I discovered that some word documents were using duplicate ids for the problematic lists. Not sure how that happened though.

John Richardson Fullstack PHP developer

*m. 07957918063 w. http://john-richardson.net e. @.

If you're happy with the services provided, please consider leaving a review on Trustpilot https://www.trustpilot.com/evaluate/john-richardson.net. Thanks.

On Mon, 30 Jun 2025, 07:11 Mateusz Bagiński, @.***> wrote:

Mati365 left a comment (ckeditor/ckeditor5#18015) https://github.com/ckeditor/ckeditor5/issues/18015#issuecomment-3017922414

I checked it on Firefox 138 with recent master and:

  1. Microsoft Outlook New 1.2024.1126.100 (client version 20250620014.12).
  2. Microsoft Outlook Classic 2021

and it works fine.

— Reply to this email directly, view it on GitHub https://github.com/ckeditor/ckeditor5/issues/18015#issuecomment-3017922414, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTS6YEAAGQQTA5O5M6IB233GDIILAVCNFSM6AAAAABYA5VMJ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMJXHEZDENBRGQ . You are receiving this because you commented.Message ID: @.***>

jr-cobweb avatar Jun 30 '25 06:06 jr-cobweb

@maryia-kabash , sorry for the late reply, we were closing a pretty big release scope, and this was the next item on the list. Thankfully, we managed to find a solution just in time, and this should be a part of the next release.

Witoso avatar Jun 30 '25 13:06 Witoso