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
Raw Handling: Paste from MS Excel no longer creates a table block #42570
Pasting content from Microsoft Excel as a table is not working as expected. I expect to content copied from an Excel spreadsheet to create a table block when pasted in the editor. Instead, it pastes as a paragraph block.
Copying and pasting from Google Sheets works as expected -- it creates a table block in the editor. But copying and pasting from Excel appears to strip the HTML during an intermediary step between pasting and block creation (see screen recording).
This issue appears to have originated in v5.9, but I'm not sure. I used the "WP Downgrade | Specific Core Version" plugin to downgrade from 6.0.1 to 5.8.4 (my end users noticed the issue begin around March or April) and copy-paste from Excel works as expected in 5.8.4.
Step-by-step reproduction instructions
Create an Excel spreadsheet with some content.
Go to Pages > Add New.
Copy the content of the Excel spreadsheet into the WP editor.
See error.
Repeat steps from Google Sheets to see expected behavior.
Screenshots, screen recording, code snippet
On a fresh local WordPress 6.0.1 installation:
Environment info
WordPress 6.0.1, not using Gutenberg plugin, default Twenty Twenty-One theme, and no plugins active. Issue appears in Twenty-Twenty Two theme as well, and when downgraded as far as WordPress 5.9.
Firefox 102.0.1 (64-bit). Issue also appears in Chrome (103.0.5060.134) and Edge (103.0.1264.62).
Desktop with Windows 10.
WordPress running in local Docker environment. Issue also appears in WP 6.0.1 running in hosted environment.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
I think it would be better to add the test proposed in #34235 first, so that the resolution of this issue does not cause regression #33607 to the contrary.
changed the title [-]Paste from MS Excel no longer creates a table block[/-][+]Raw Handling: Paste from MS Excel no longer creates a table block[/+]on Aug 3, 2023
@admturner, or anyone else, could you please share the HTML that is logged in the console so we can fix and add a test? Example: #46832. No need to provide an example file. Thanks!
Are you positive that this is the markup you're receiving?
Yes. Why such HTML is received is discussed in this comment.
Even in the gif image seen at the beginning of this issue, you can see that such HTML is recorded in the browser console, so it shouldn't be a problem in my environment.
Activity
t-hamano commentedon Nov 12, 2022
@admturner
Thank you for your contribution.
I have confirmed that this process for Windows, added by #33607, caused the regression.
gutenberg/packages/block-editor/src/components/rich-text/use-paste-handler.js
Lines 91 to 92 in 92d28ca
Received HTML data differs depending on the presence or absence of this process:
With removeWindowsFragments
Without removeWindowsFragments
As the above data shows, data pasted from MS Excel has
StartfragmentandEndFragmentin the Table tag.Since #33607 removes the outside of the fragments, the removal of the table tag would have caused it to no longer match the table schema.
t-hamano commentedon Nov 12, 2022
I think it would be better to add the test proposed in #34235 first, so that the resolution of this issue does not cause regression #33607 to the contrary.
[-]Paste from MS Excel no longer creates a table block[/-][+]Raw Handling: Paste from MS Excel no longer creates a table block[/+]ellatrix commentedon Oct 9, 2023
@admturner, or anyone else, could you please share the HTML that is logged in the console so we can fix and add a test? Example: #46832. No need to provide an example file. Thanks!
t-hamano commentedon Oct 9, 2023
Below are the screencast and recorded logs. I also investigated the cause of this issue in this comment.
bcf47031253d3eb4ab3d51c3c112a657.mp4
Testing Environment
t-hamano commentedon Oct 10, 2023
Yes. Why such HTML is received is discussed in this comment.
Even in the gif image seen at the beginning of this issue, you can see that such HTML is recorded in the browser console, so it shouldn't be a problem in my environment.