-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markup stripped when pasting into Gutenberg (tables, definition lists mangled) #6902
Comments
I've tested this with 4.0 and seems to be working mostly alright except with the HTML involving "definition lists" and "html tags": Both posts can be found here:
|
Hey @wekhter and @iamgabrielma could you do a test with the current Gutenberg plugin, a default theme and WordPress 5.6 and see if this is still an issue? Thanks! |
WordPress 5.7 beta version 3. Testing: What I saw: I believe this issue has been fixed, and will go ahead and close it. If I am mistaken then let me know and I will reopen. |
Describe the bug
Markup was stripped out of posts when pasted into Gutenberg, including: parts of tables, definition lists, other tags
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expected the content to paste normally & split off into blocks by type (paragraph, heading, table, etc) while retaining markup
Screen Recording
https://www.useloom.com/share/1757c9b94d7e433e8e2098facf21bbf3
Desktop
Additional context
I was trying to test the frontend styles gutenberg applies using some markup based on the Theme Unit Test to check theme styles, but found that certain parts of my markup were stripped out unexpectedly. Watch the screen recording to see the exact behavior.
thead
and three columns in thetbody
but gutenberg stripped out the third emptyth
from mythead
<address>
tag was stripped out<cite>
tag was stripped out<q>
tag was stripped out. (note also that in the video I meant to simply add the<q>
tags in within the paragraph, which gutenberg does correctly save as<p><q></q></p>
but I panicked and replaced the<p>
tags directly, so when I clicked convert to block it went ahead and stripped the tags I'd just written... feels like there should be a more friendly way to handle situations like that than to just undo someone's work)<var>
tag was stripped out.Now I know that not everyone uses
<cite>
as part of their quotes, and<address>
,<q>
and<var>
are pretty uncommon, but since they are a part of the theme test I was doing I left them in the report.Issue: Tables
In the example you see that what ends up being stripped out is an empty
<th>
from the<thead>
. That might not seem like a huge deal, but that's just one example of the issues with pasting tables. The same thing happens if the table pasted contains an empty<td>
(the cell doesn't show up at all). This behavior isn't limited to<th>
or<td>
s at the end of a row, it can also happen when it's content in the middle of a row--so for a table where you might have had an empty cell in lieu of a n/a:|_A_|_B_|_C_|
|_1_|_2_|_3_|
|_1_|___|_3_|
|_1_|_2_|_3_|
Will paste into gutenberg as:
|_A_|_B_|_C_|
|_1_|_2_|_3_|
|_1_|_3_|
|_1_|_2_|_3_|
If a user pastes a table and finds that cells are not pasted, they'd have to fix it in HTML--the "add column" button inserts the column on all rows and the "delete column" deletes it on all rows, so there's no way to restore missing cells from the visual editor.
Issue: Definition lists
These have never been a part of the classic editor, but it's always been possible to write them (by switching to HTML) or to paste them from another source and continue to edit in either the HTML or visual editor. I was expecting to be able to edit them visually, just like I would a list or a table, but at the very least I would have wanted gutenberg to automatically convert it to an HTML block or something so I wouldn't completely lose the formatting.
The text was updated successfully, but these errors were encountered: