Update HTML Custom block to use isSelected for raw HTML view and by d… #46836
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR is to put the Custom HTML block in preview mode, and on select show raw HTML.
Why?
Raw HTML is sometimes unavoidable and can be scary or jarring to the enduser. In order to maintain a what-you-see-is-what-you-get feel in the block editor, it is important to have the Custom HTML block look more at home with the rest of the blocks/content in the editor.
How?
This is just a small change to the block so it always displays in preview mode unless selected or empty.
Testing Instructions
1.) Create a new post or open an existing one.
2.) Add a new or edit an existing Custom HTML Block.
3.) Once content is added Custom HTML block should be in preview mode (if Custom HTML block is there already, that should be in preview mode too).
4.) On select the block should display raw HTML and be able to be edited.
5.) If all content is removed (or only whitespace), Custom HTML block should not be in preview mode no matter what.
Testing Instructions for Keyboard
N/A. No significant changes were made to the general UI of the block. Prevew | HTML buttons have been removed as they are no longer needed.