Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-use-flat-inner-blocks-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy authored Sep 20, 2024
2 parents b7a5fea + d6bd752 commit 4b2de20
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/post-primary-term/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { __ } from '@wordpress/i18n';
import { decodeEntities } from '@wordpress/html-entities';
import { usePrimaryTerm } from '../../hooks';

interface PostPrimaryTermProps {
Expand Down Expand Up @@ -50,5 +51,5 @@ export const PostPrimaryTerm = ({
wrapperProps.href = termUrl;
}

return <Tag {...wrapperProps}>{termString}</Tag>;
return <Tag {...wrapperProps}>{decodeEntities(termString)}</Tag>;
};
14 changes: 14 additions & 0 deletions example/src/blocks/primary-category/block.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 12 additions & 0 deletions example/src/blocks/primary-category/edit.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div {...blockProps}>
<PostPrimaryCategory />
</div>
)
};
9 changes: 9 additions & 0 deletions example/src/blocks/primary-category/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { registerBlockType } from '@wordpress/blocks';
import metadata from './block.json';
import { BlockEdit } from './edit';


registerBlockType( metadata, {
edit: BlockEdit,
save: () => null
});

0 comments on commit 4b2de20

Please sign in to comment.