-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
­ tags get sanitized when using "Edit Block as HTML" #23509
Comments
Similar to #24282. I can confirm that:
|
Update.I created an I then debugged the block The result of that routine is that Reloading the browser at this point will cause the editor to boot and the I believe the problem is that the parser code for blocks with source type of gutenberg/packages/blocks/src/api/matchers.js Lines 40 to 41 in 0d2771b
This uses This means that the block's content is then converted into a version with most (but not all) entities converted. This form of the block is then saved and the original content is lost forever. ConclusionMy take is that the HTML block doesn't do what we expect. If we enter HTML entities such as Basically:
|
The same happens in the code editor. The workaround to hit the save draft button does not work for me. Saving the draft or updating the post strips the tag from the content. |
I just struggled with the same problem when trying to implement soft hyphens in the Furthermore I think the original question of this ticket was about the html mode of a block ("edit block as HTML") whereas @getdave tests and answers refer to the HTML block. A solution might solve both though. |
heavily related to #12872 |
Highly likely. I've still got this on my radar but unlikely until after WordPress 5.8 is released. |
I am running WordPress 5.9.3 (with a child theme of GeneratePress, but I think this is not a theme issue). I am using a classic block because I already had HTML code for the table I need and pasting it in was the fastest way to get it in there. At small screen sizes, I need hypenation. I can insert a soft hyphen and watch it magically disappear as soon as I save the draft, sometimes sooner. When I view page source in the browser there is no Is there any hope for a fix in the WordPress editor? There is a PHP solution, perhaps, but it would be nicer if soft hyphen support was built in. A PHP solution is given at Stack Exchange. |
Current behaviour (6.4.2, TT3 theme, with Firefox) is now: Do the following steps:
Now it starts to get odd. When pressing delete in front of the hyphen you delete the next character, not the hyphen. If you use backspace, you can delete it. If you switch back to html editor, the soft hyphen shows as a hyphen character When switching to frontend, the hyphen behaves as should, except that it's not in the html code (use source view or inspector tools). This is quite odd. Expected behaviour would be:
It also baffles me why the entity is removed from the html code, only to have some other code adding a soft hyphen (not sure how) still. Someone went to a lot of trouble only to code the behaviour of a soft hyphen instead of just using html standards. The best solution would anyway be to fix soft hyphens with #55565 |
I'm having the same issue. When I write the following HTML, on save the encoded HTML symbols get turned into the actual characters. Breaking the heading's content, which is supposed to show those tags. That's why I encoded them to begin with.
|
Describe the bug
When using (maybe other HTML entities too) with edit block as HTML the tag get's sanitized right after saving the post.
Before save:
After save:
Editor version (please complete the following information):
The text was updated successfully, but these errors were encountered: