Users are reporting an issue with copying tables from Excel 365 to Discourse, where the paste results in an image and plain text instead of a formatted table, unlike with Excel 2013. The problem appears to stem from how Office 365 handles clipboard data, with multiple formats being copied, including images and plain text. Discussions point to a need for Discourse’s JavaScript to better handle clipboard data by prioritizing plain text over images when available. A fix was proposed and implemented in a commit by vinothkannans, which prevents uploads when plain text is present. Users confirmed the fix works for multi-column and multi-row data. Some users also noted that single-column or single-row data, as well as bulleted lists and mixed text, are handled correctly. The issue is resolved, though minor edge cases remain.
So I’ve just upgraded from Office 2013 to Office 365.
Now when I copy cells from Excel 365 to Discourse I get an image and plain text.
When I copy from Excel 2013 I get Discourse cells in my post, I liked this but can’t get that now with 365.
Any clue how I can fix this?
I believe @vinothkannans has fixed similar issues in the past, the tricky thing is that office loves putting lots and lots of different formats in the clipboard and it is hard to find the right one.
I’ve seen this issue from Excel for months. Google Drive works just fine, so I’ve been copying from Excel to Google to Discourse when I need to paste a table. Pretty sure there’s an open bug for this, can’t find it though.
I think Windows likes putting stuff in lots of different clipboards sections associated to various types. Our JS piece needs to be able to handle that and only ever pick a single clipboard section.
We already try only to pick one format per:
But maybe somehow we are also pasting the image here as well and should have some code that says… hi… I got text here… ignore the image.
Super minor and unresolvable. We are unconditionally treating first row as “title” when in fact we may just be pasting in data. A tiny be of extra cutting and pasting can fix that, so I am not seeing it as a drama
I wasn’t reporting a problem. I was only showing how it also worked correctly for text and didn’t cause any problem with markdown characters, i.e. the asterisk bullet point * .