Skip to content

Commit

Permalink
Decode entities in social previews
Browse files Browse the repository at this point in the history
  • Loading branch information
sixhours committed Nov 19, 2024
1 parent 3c01134 commit 5ac4875
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { Button, Modal, TabPanel } from '@wordpress/components';
import { decodeEntities } from '@wordpress/html-entities';
import { __ } from '@wordpress/i18n';
import { close } from '@wordpress/icons';
import { useAvailableSerivces } from './use-available-services';
Expand All @@ -15,6 +16,9 @@ const SocialPreviewsModal = function SocialPreviewsModal( { onClose, initialTabN
const availableServices = useAvailableSerivces();
const { image, media, title, description, url, excerpt } = usePostData();

const decodedTitle = decodeEntities( title );
const decodedDescription = decodeEntities( description );

return (
<Modal
onRequestClose={ onClose }
Expand All @@ -37,8 +41,8 @@ const SocialPreviewsModal = function SocialPreviewsModal( { onClose, initialTabN
<tab.preview
// pass only the props that are common to all previews
excerpt={ excerpt }
title={ title }
description={ description }
title={ decodedTitle }
description={ decodedDescription }
url={ url }
image={ image }
media={ media }
Expand Down

0 comments on commit 5ac4875

Please sign in to comment.