Skip to content

Commit

Permalink
Site Title: Decode entities (#33323)
Browse files Browse the repository at this point in the history
* Update packages/block-library/src/site-title/edit/index.js
* Move decode
* Revert site title decode in site title block

Co-authored-by: George Mamadashvili <[email protected]>
  • Loading branch information
Petter Walbø Johnsgård and Mamaduka authored Jul 13, 2021
1 parent cb9d515 commit 54e8671
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/block-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@wordpress/element": "file:../element",
"@wordpress/escape-html": "file:../escape-html",
"@wordpress/hooks": "file:../hooks",
"@wordpress/html-entities": "file:../html-entities",
"@wordpress/i18n": "file:../i18n",
"@wordpress/icons": "file:../icons",
"@wordpress/is-shallow-equal": "file:../is-shallow-equal",
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/site-title/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useBlockProps,
} from '@wordpress/block-editor';
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand All @@ -34,7 +35,7 @@ export default function SiteTitleEdit( {
const siteData = getEntityRecord( 'root', '__unstableBase' );
return {
canUserEdit: canUser( 'update', 'settings' ),
readOnlyTitle: siteData?.name,
readOnlyTitle: decodeEntities( siteData?.name ),
};
}, [] );
const TagName = level === 0 ? 'p' : `h${ level }`;
Expand Down
1 change: 1 addition & 0 deletions packages/edit-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@wordpress/editor": "file:../editor",
"@wordpress/element": "file:../element",
"@wordpress/hooks": "file:../hooks",
"@wordpress/html-entities": "file:../html-entities",
"@wordpress/i18n": "file:../i18n",
"@wordpress/icons": "file:../icons",
"@wordpress/interface": "file:../interface",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
import { useEffect, useRef } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { ESCAPE } from '@wordpress/keycodes';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -95,7 +96,7 @@ const NavigationPanel = ( { isOpen } ) => {
<div className="edit-site-navigation-panel__inner">
<div className="edit-site-navigation-panel__site-title-container">
<div className="edit-site-navigation-panel__site-title">
{ siteTitle }
{ decodeEntities( siteTitle ) }
</div>
</div>
<div className="edit-site-navigation-panel__scroll-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useSelect } from '@wordpress/data';
import { wordpress } from '@wordpress/icons';
import { filterURLForDisplay } from '@wordpress/url';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -105,7 +106,7 @@ function PostPublishPanelPrepublish( { children } ) {
{ siteIcon }
<div className="components-site-info">
<span className="components-site-name">
{ siteTitle || __( '(Untitled)' ) }
{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }
</span>
<span className="components-site-home">{ siteHome }</span>
</div>
Expand Down

0 comments on commit 54e8671

Please sign in to comment.