Bug #23969
openCopy and pasting HTML pages into paragraph blocks loses certain formatting
0%
Description
Copy and pasting HTML pages into paragraph blocks loses underlining. Interestingly, other formatting (e.g., boldface) remains. This seems like a relatively new development.
To reproduce, copy any underlined text on an HTML page into a paragraph block. I have attached a page with underlined text.
May be related to: https://wordpress.org/support/topic/pasting-in-post-loses-formatting/. But, I don't seem to have the mentioned plug-in installed. Moreover, I haven't changed the plug-in structure very much lately.
Files
Updated by Raffi Khatchadourian 3 days ago
May be related to https://redmine.gc.cuny.edu/issues/23169 but unsure. My guess is that it has something to do with recent theme updates. But, it is the editor that has the problem, so maybe it's a Wordpress update?
Updated by Raffi Khatchadourian 3 days ago
- Subject changed from Copy and pasting HTML pages into classic blocks loses certain formating to Copy and pasting HTML pages into paragraph blocks loses certain formatting
Updated by Boone Gorges about 15 hours ago
Seems like this is, in part, a design decision by the WP team. See https://github.com/WordPress/gutenberg/issues/15590#issuecomment-523794936 and surrounding discussion. The 'u' tag is not part of the allowed HTML in the block editor, and underline is represented internally with a span that has a style declaration; but inline CSS is not "semantic" in the sense discussed here. This seems like a bit of odd inconsistency to me; if they represent underlines as styled spans, why wouldn't 'u' elements be translated into such on paste?
Anyway, I think this is beyond what we're able to fix, as it appears to be an intentional decision in WP. The only workaround I can offer at this time is to convert your 'u' elements to spans with style="text-decoration:underline;". See screenshot.
Updated by Raffi Khatchadourian about 14 hours ago
Interesting! It works fine in the classic block. Thanks, I'll try that.