Skip to content

Inline HTML comments are removed when a Block is edited #13318

@danielbachhuber

Description

@danielbachhuber

Describe the bug

If a Block has an inline HTML comment, the HTML comment is stripped out when the Block is modified.

Sample text:

This is my paragraph text with <!-- html-comment -->an HTML comment<!-- /html-comment -->

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Paragraph Block.
  2. Add the sample text in HTML mode.
  3. Switch to Visual mode.
  4. Switch back to HTML mode and see that the HTML comment persists.
  5. Switch to Visual mode and make some edit to the text.
  6. Switch back to HTML mode and see that the HTML comment has disappeared.

See GIF:

htmlcommentdisappear

Expected behavior

My expected behavior is that the HTML comment persists when I edit the text.

In the scenario where I edit within the boundary of the HTML comment, my expected behavior is that the Block Editor would mirror the Classic Editor.

Desktop (please complete the following information):

  • OS: Mac OS 10.14.2
  • Browser: Firefox 64.0.2
  • Version: Gutenberg 4.8.0

Metadata

Metadata

Assignees

Labels

[Package] Format library/packages/format-library[Package] Rich text/packages/rich-text[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions