Open Clorith opened 6 years ago
I can confirm this is still an issue.
This is still an issue. In fact, simply opening a "classic" post in Gutenberg (without the Classic Editor plugin installed) then making one change (even if it's to the post metadata and not to the post content itself) and saving will cause the script and style code to stop rendering in the post, although you can still see the code in the code editor view. Then if you convert to blocks, all the style code seems to be stripped and all the script code is converted to paragraph blocks that behave oddly. For example, in the visual editor if you switch the block to edit as HTML then cut the script tags to move them to another block leaving only the surrounding p tags (see below), the block will no longer display a menu for switching back to visual editing or even removing the block, and you have to switch to the code editor view to delete the block tags.
Also in these new paragraph blocks, p tags have also been added to the surrounding code. The only way around this I've found is to edit in code editor and manually replace the paragraph block tags with HTML block tags, but then when you save that, br tags are inserted after every line in the HTML block tag sections, so you have to search/replace those to remove them or your script code may not work.
When you write a post, many users that just run their very own site have unfiltered HTML access. This allows them to put styles and scripts into the post content, and many do this, following guides and tutorials on the net, or just needing a quick fix on a single particular page.
When you open a page with
script
orstyle
tags in the post content, they are displayed in the visual mode first, this in it self adds unwantedbr
tags to the styles section which modifies existing content in the classic editor even without converting to blocks.If you do convert to blocks, both styles and scripts are converted to regular paragraphs, with linebreaks showing as plain text
<br>
inside those paragraphs.There are two expected outcomes here:
style
andscript
tags to be converted into the Custom HTML block, to retain their functionality even after converting