-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Patterns: Add missing decoding entities processing in Patterns and Template/Parts pages #52449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,13 @@ import { | |
| } from '@wordpress/components'; | ||
| import { store as coreStore } from '@wordpress/core-data'; | ||
| import { store as noticesStore } from '@wordpress/notices'; | ||
| import { decodeEntities } from '@wordpress/html-entities'; | ||
|
|
||
| export default function RenameMenuItem( { template, onClose } ) { | ||
| const [ title, setTitle ] = useState( () => template.title.rendered ); | ||
| const [ title, setTitle ] = useState( | ||
| decodeEntities( template.title.rendered ) | ||
| ); | ||
|
|
||
| const [ isModalOpen, setIsModalOpen ] = useState( false ); | ||
|
|
||
| const { | ||
|
|
@@ -69,12 +73,7 @@ export default function RenameMenuItem( { template, onClose } ) { | |
|
|
||
| return ( | ||
| <> | ||
| <MenuItem | ||
| onClick={ () => { | ||
| setIsModalOpen( true ); | ||
| setTitle( template.title.rendered ); | ||
| } } | ||
| > | ||
| <MenuItem onClick={ () => setIsModalOpen( true ) }> | ||
|
||
| { __( 'Rename' ) } | ||
| </MenuItem> | ||
| { isModalOpen && ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decoding here eliminates the need for separate decoding in the lower-layer components. This is consistent with the fact that
reusableBlockToPatternin the same file usestitle.rawas the value of the title property.