You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Copy Paste Bullet/Number list from MS Word Document #4761
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.
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
@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?
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!
@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 :)
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.
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.
Activity
acywatson commentedon Jul 26, 2023
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.
muleyprasanna commentedon Jul 27, 2023
BulletList.txt
NumberedList.txt
We are getting the html from the clipboard. PFA. Thanks you very much for your response.
MauricioGrM commentedon Feb 18, 2025
I am just keeping eyes on the progress of this one, I was testing this morning, and I am getting the same issue
etrepum commentedon Feb 18, 2025
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.
[-]Bug: Copy Paste Bullet/Number list from MS Word Document[/-][+]Feature: Copy Paste Bullet/Number list from MS Word Document[/+]juliankrispel commentedon Jul 14, 2025
Just blogged about this explaining a workaround for several different frameworks including lexical, hoping it's helpful 🙏
harshmetkel24 commentedon Jul 15, 2025
@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?
harshmetkel24 commentedon Jul 21, 2025
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!
etrepum commentedon Jul 21, 2025
The solution to addressing any HTML import issue is addressed by my previous comment, you need to override importDOM or the html config accordingly.
juliankrispel commentedon Jul 31, 2025
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 :)
juliankrispel commentedon Jul 31, 2025
I don't think that's quite the right approach tbh, since word doesn't output semantic html
etrepum commentedon Jul 31, 2025
That's exactly why you have to override the default implementation, the one that's designed for semantic markup.
juliankrispel commentedon Aug 1, 2025
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.
tomsarduy commentedon Apr 10, 2026
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.