Skip to content

Commit

Permalink
Site Editor: Remove extra div on post content (#38451)
Browse files Browse the repository at this point in the history
* Post Content: Remvoe extra div when post content is rendered in the site editor

* Post Content: Remvoe extra div when post content is rendered in the site editor

* Dangerously set html directly without using RawHTML

* Set HTML without creating an element

* fix lint offence

Co-authored-by: ntsekouras <ntsekouras@outlook.com>
  • Loading branch information
scruffian and ntsekouras authored Feb 7, 2022
1 parent f931779 commit 9423769
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-library/src/post-content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { RawHTML } from '@wordpress/element';
import {
useBlockProps,
useInnerBlocksProps,
Expand Down Expand Up @@ -32,9 +31,10 @@ function ReadOnlyContent( { userCanEdit, postType, postId } ) {
<Warning>{ __( 'This content is password protected.' ) }</Warning>
</div>
) : (
<div { ...blockProps }>
<RawHTML key="html">{ content?.rendered }</RawHTML>
</div>
<div
{ ...blockProps }
dangerouslySetInnerHTML={ { __html: content?.rendered } }
></div>
);
}

Expand Down

0 comments on commit 9423769

Please sign in to comment.