Skip to content

Commit 2ae1f24

Browse files
Mamadukacreativecoder
and
creativecoder
authored
Editor: Remove HTML from the post title in the document bar (#68358)
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: creativecoder <[email protected]>
1 parent b1f23ea commit 2ae1f24

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/editor/src/components/document-bar/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { store as commandsStore } from '@wordpress/commands';
2222
import { useRef, useEffect } from '@wordpress/element';
2323
import { useReducedMotion } from '@wordpress/compose';
2424
import { decodeEntities } from '@wordpress/html-entities';
25+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
2526

2627
/**
2728
* Internal dependencies
@@ -200,7 +201,7 @@ export default function DocumentBar( props ) {
200201
<Text size="body" as="h1">
201202
<span className="editor-document-bar__post-title">
202203
{ title
203-
? decodeEntities( title )
204+
? stripHTML( title )
204205
: __( 'No title' ) }
205206
</span>
206207
{ pageTypeBadge && (

packages/editor/src/components/post-card-panel/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
1212
import { useSelect } from '@wordpress/data';
1313
import { useMemo } from '@wordpress/element';
1414
import { __, sprintf } from '@wordpress/i18n';
15-
import { decodeEntities } from '@wordpress/html-entities';
15+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
1616

1717
/**
1818
* Internal dependencies
@@ -94,7 +94,7 @@ export default function PostCardPanel( {
9494
labels?.name
9595
);
9696
} else if ( postTitle ) {
97-
title = decodeEntities( postTitle );
97+
title = stripHTML( postTitle );
9898
}
9999

100100
return (

0 commit comments

Comments
 (0)