Skip to content

Feature: Copy Paste Bullet/Number list from MS Word Document #4761

Closed

Description

@muleyprasanna

Lexical version: 0.11.1

Steps To Reproduce

  1. Copy bullet/numbered list from word document
  2. Paste it in Lexical Rich Text Editor
  3. The list not getting render in lexical bullet/numbered list format

Link to code example:

The current behavior

Copy pasted bullet/numbered list aren't displayed correctly

The expected behavior

Copy pasted bullet/numbered list need to be displayed correctly

MS Word List Screenshot
BulletList_Bug1

Rich Text Editor Screenshot (After bullet list paste from word document)
BulletList_Bug2

Rich Text Editor Screenshot (After numbered list paste from word document)
BulletList_Bug3

Rich Text Editor Screenshot (Expected bullet list behaviour)
BulletList_Expected1

Rich Text Editor Screenshot (Expected numbered list behaviour)
BulletList_Expected2
(url)

Activity

  1. acywatson commented on Jul 26, 2023

    @acywatson
    Contributor

    Can you help me out by pasting in here the HTML that MS Word puts on the clipboard? The issue is going to be that they're not using semantic HTML.

  2. muleyprasanna commented on Jul 27, 2023

    @muleyprasanna
    Author

    BulletList.txt
    NumberedList.txt

    We are getting the html from the clipboard. PFA. Thanks you very much for your response.

  3. MauricioGrM commented on Feb 18, 2025

    @MauricioGrM

    I am just keeping eyes on the progress of this one, I was testing this morning, and I am getting the same issue

  4. etrepum commented on Feb 18, 2025

    @etrepum
    Collaborator

    Lexical's behavior is correct, Word isn't putting semantic HTML on the clipboard and Lexical is just importing what it sees. You'll get the same behavior if you paste this HTML into Google Docs for example.

    I'm sure you could implement a workaround with importDOM and/or the editor's html.import configuration but having specific support for this non-semantic MS Word HTML dialect is not something that's likely to be included in the core by default.

  5. changed the title [-]Bug: Copy Paste Bullet/Number list from MS Word Document[/-] [+]Feature: Copy Paste Bullet/Number list from MS Word Document[/+] on Feb 18, 2025
  6. added
    copy+paste
    lists
    on Feb 18, 2025
  7. juliankrispel commented on Jul 14, 2025

    @juliankrispel

    Just blogged about this explaining a workaround for several different frameworks including lexical, hoping it's helpful 🙏

  8. harshmetkel24 commented on Jul 15, 2025

    @harshmetkel24
    Contributor

    @juliankrispel did you tested this code with lexical? I've tried in local its not working as expected. Also the markup exported from word appears to be completely different than what implemented in blog post. Any idea if am I doing something wrong?

    Image
  9. harshmetkel24 commented on Jul 21, 2025

    @harshmetkel24
    Contributor

    Hi @etrepum,
    I’ve tried an approach that addresses most cases. I understand that this type of change may not be suitable for inclusion in the Lexical core, but I’ve opened a PR in case others facing the same issue might find it helpful or inspirational. I would also appreciate it if you could take a look and let me know if anything is incorrect or could be improved.
    Additionally, I’ve noticed that content with applied font-size, when copied from sources like Google Docs or MS Office, is not working as expected. Do we have an existing open issue for this, or any quick tips to address it?
    Thank you!

  10. etrepum commented on Jul 21, 2025

    @etrepum
    Collaborator

    The solution to addressing any HTML import issue is addressed by my previous comment, you need to override importDOM or the html config accordingly.

  11. juliankrispel commented on Jul 31, 2025

    @juliankrispel

    @juliankrispel did you tested this code with lexical? I've tried in local its not working as expected. Also the markup exported from word appears to be completely different than what implemented in blog post. Any idea if am I doing something wrong?

    I certainly did - using something similar for a client. I can't tell you what you did wrong because I can't see your code :)

  12. juliankrispel commented on Jul 31, 2025

    @juliankrispel

    The solution to addressing any HTML import issue is addressed by my previous comment, you need to override importDOM or the html config accordingly.

    I don't think that's quite the right approach tbh, since word doesn't output semantic html

  13. etrepum commented on Jul 31, 2025

    @etrepum
    Collaborator

    That's exactly why you have to override the default implementation, the one that's designed for semantic markup.

  14. juliankrispel commented on Aug 1, 2025

    @juliankrispel

    That's exactly why you have to override the default implementation, the one that's designed for semantic markup.

    I'm mot sure I follow tbh. I'll try and explain once more.
    Here's my take: The import configuration is expecting semantic html.
    It therefore makes more sense to first make the html semantic, otherwise you're just polluting the import configuration with word-specific and then google-specific and then whatever other crappy content you need to parse. This is why I and the clients I have implemented this for with lexical and other frameworks are generally happier with separating these concerns.

  15. tomsarduy commented on Apr 10, 2026

    @tomsarduy
    Contributor

    I've been digging and playing with different clients/formats and the Outlook client does a very good job at producing good semantic inline styles html, so maybe have a look at whatever RoosterJs does. I tested with their demo here and support all kind of formats. My PR just add basic support for css classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    copy+pastelists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions