Skip to content

Commit

Permalink
Fix ExcerptPanel decode issue (#62336)
Browse files Browse the repository at this point in the history
Co-authored-by: itzmekhokan <khokansardar@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
  • Loading branch information
4 people authored Jun 20, 2024
1 parent cd965c7 commit bb79514
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/editor/src/components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
import { ExternalLink, TextareaControl } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useState } from '@wordpress/element';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -52,7 +53,9 @@ export default function PostExcerpt( {
[]
);
const { editPost } = useDispatch( editorStore );
const [ localExcerpt, setLocalExcerpt ] = useState( excerpt );
const [ localExcerpt, setLocalExcerpt ] = useState(
decodeEntities( excerpt )
);
const updatePost = ( value ) => {
editPost( { [ usedAttribute ]: value } );
};
Expand Down
3 changes: 2 additions & 1 deletion packages/editor/src/components/post-excerpt/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { useMemo, useState } from '@wordpress/element';
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -173,7 +174,7 @@ function PrivateExcerpt() {
}
const excerptText = !! excerpt && (
<Text align="left" numberOfLines={ 4 } truncate>
{ excerpt }
{ decodeEntities( excerpt ) }
</Text>
);
if ( ! allowEditing ) {
Expand Down

0 comments on commit bb79514

Please sign in to comment.