diff --git a/components/post-primary-term/index.tsx b/components/post-primary-term/index.tsx index c2900226..af287fd7 100644 --- a/components/post-primary-term/index.tsx +++ b/components/post-primary-term/index.tsx @@ -1,4 +1,5 @@ import { __ } from '@wordpress/i18n'; +import { decodeEntities } from '@wordpress/html-entities'; import { usePrimaryTerm } from '../../hooks'; interface PostPrimaryTermProps { @@ -50,5 +51,5 @@ export const PostPrimaryTerm = ({ wrapperProps.href = termUrl; } - return {termString}; + return {decodeEntities(termString)}; }; diff --git a/example/src/blocks/primary-category/block.json b/example/src/blocks/primary-category/block.json new file mode 100644 index 00000000..0bb428e0 --- /dev/null +++ b/example/src/blocks/primary-category/block.json @@ -0,0 +1,14 @@ +{ + "apiVersion": 3, + "name": "example/primary-category", + "title": "Post Primary Category", + "icon": "archive", + "category": "common", + "example": {}, + "supports": { + "html": false + }, + "attributes": {}, + "variations": [], + "editorScript": "file:./index.ts" +} \ No newline at end of file diff --git a/example/src/blocks/primary-category/edit.tsx b/example/src/blocks/primary-category/edit.tsx new file mode 100644 index 00000000..ee42fba5 --- /dev/null +++ b/example/src/blocks/primary-category/edit.tsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { useBlockProps } from '@wordpress/block-editor'; +import { PostPrimaryCategory } from '@10up/block-components'; + +export const BlockEdit = ({context}) => { + const blockProps = useBlockProps(); + return ( +
+ +
+ ) +}; \ No newline at end of file diff --git a/example/src/blocks/primary-category/index.ts b/example/src/blocks/primary-category/index.ts new file mode 100644 index 00000000..d06ab1b1 --- /dev/null +++ b/example/src/blocks/primary-category/index.ts @@ -0,0 +1,9 @@ +import { registerBlockType } from '@wordpress/blocks'; +import metadata from './block.json'; +import { BlockEdit } from './edit'; + + +registerBlockType( metadata, { + edit: BlockEdit, + save: () => null +});