Skip to content

Commit

Permalink
Editor: Remove HTML from the post title in the document bar (WordPres…
Browse files Browse the repository at this point in the history
…s#68358)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: creativecoder <[email protected]>
  • Loading branch information
3 people authored Dec 27, 2024
1 parent b1f23ea commit 2ae1f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/editor/src/components/document-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { store as commandsStore } from '@wordpress/commands';
import { useRef, useEffect } from '@wordpress/element';
import { useReducedMotion } from '@wordpress/compose';
import { decodeEntities } from '@wordpress/html-entities';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';

/**
* Internal dependencies
Expand Down Expand Up @@ -200,7 +201,7 @@ export default function DocumentBar( props ) {
<Text size="body" as="h1">
<span className="editor-document-bar__post-title">
{ title
? decodeEntities( title )
? stripHTML( title )
: __( 'No title' ) }
</span>
{ pageTypeBadge && (
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/components/post-card-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { useMemo } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { decodeEntities } from '@wordpress/html-entities';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';

/**
* Internal dependencies
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function PostCardPanel( {
labels?.name
);
} else if ( postTitle ) {
title = decodeEntities( postTitle );
title = stripHTML( postTitle );
}

return (
Expand Down

0 comments on commit 2ae1f24

Please sign in to comment.