Site Editor: Decode HTML entities in Identity fields - #81269
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @drewmt! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Perhaps the key is where to decode. Personally, I think it might be best to fix it directly in the field where the problem occurs, as a minimal fix. Perhaps like this.
const fields = [
{
id: 'title',
type: 'text',
label: __( 'Site Title' ),
description: __(
"Displays in your site's layout via the Site Title block."
),
getValue: ( { item } ) => decodeEntities( item.title ?? '' ),
},
// ...
];Furthermore, please note that this issue occurs across all fields of the identity screen, meaning the problem with the media field also needs to be resolved.
|
Thanks for the guidance! I've moved decoding into the Identity title and tagline getters, and covered attachment titles in MediaEdit for both the visible filename and replacement label. I also added regressions for all four fields; 36 relevant tests pass locally. |
dec1f3b to
ca6214c
Compare
|
Thanks, Nik! I've rebased onto the latest trunk and resolved the changelog conflicts. The PR is mergeable again, and the fresh checks are running. |
|
There was a conflict while trying to cherry-pick the commit to the wp/7.1 branch. Please resolve the conflict manually and create a PR to the wp/7.1 branch. PRs to wp/7.1 are similar to PRs to trunk, but you should base your PR on the wp/7.1 branch instead of trunk. |
|
@drewmt can you handle the manual backport to |
|
Thanks, Nik! I've opened #81320 with the manual backport to |
Co-authored-by: drewmt <linewebdigital@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
Co-authored-by: drewmt <linewebdigital@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`. A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@ea285b4...b9743a0 - Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277) - Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265) - Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291) - Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308) - theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253) - theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309) - Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311) - Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320) - Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374) - Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375) - Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385) - fix: order site identity changes predictably (WordPress/gutenberg#81283) - Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444) - components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446) - Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406) - Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296) Props wildworks. See #65529. git-svn-id: https://develop.svn.wordpress.org/branches/7.1@63209 602fd350-edb4-49c9-b593-d223f7449a82
Co-authored-by: drewmt <linewebdigital@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`. A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@ea285b4...b9743a0 - Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277) - Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265) - Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291) - Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308) - theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253) - theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309) - Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311) - Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320) - Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374) - Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375) - Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385) - fix: order site identity changes predictably (WordPress/gutenberg#81283) - Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444) - components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446) - Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406) - Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296) Props wildworks. See #65529. Built from https://develop.svn.wordpress.org/branches/7.1@63209 git-svn-id: http://core.svn.wordpress.org/branches/7.1@62402 1a063a9b-81f0-0310-95a4-ce76da25c4cd


What?
Closes #81252.
Decode HTML entities where Site Editor Identity values are displayed:
Why?
Identity REST values can contain strings such as
Jordan's TestorLogo & Mark. Plain React text controls otherwise display those entitiesliterally instead of showing the readable title.
How?
The Identity text fields decode their values in their local
getValuefunctions.
MediaEditdecodes the attachment's RESTtitle.renderedvalue atthe two text display boundaries: the compact filename and expanded replacement
label.
This keeps the change local to the affected screen/components. Source records,
IDs, URLs, alt text, sorting, filtering, validation, and unrelated DataForm
fields remain unchanged.
Testing Instructions
Automated checks run locally:
git diff --checkpassed.No new test dependency or test files are introduced; the change stays limited
to the affected display-time
decodeEntitiescalls.Manual verification:
&,', or angle brackets.than HTML entities.
&.&rather than&.Testing Instructions for Keyboard
the form remains fully operable.
Screenshots or screencast
Not included; this restores the readable text represented by existing stored
values and does not introduce a new visual state.
Use of AI Tools
OpenAI Codex was used to help trace the value flow and run validation. I
reviewed the resulting diff and take responsibility for the contribution.