From 54dfbb7d58f6876a0faaf78405b0888581e4ac6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Wed, 22 Feb 2023 07:58:17 +0100 Subject: [PATCH 1/3] fix add back inline default value to prevent undefined error --- components/author/index.js | 6 +++--- components/post-term-list/index.js | 2 +- components/post-term-list/item.js | 2 +- components/post-title/index.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/author/index.js b/components/author/index.js index 8fe39562..11f52641 100644 --- a/components/author/index.js +++ b/components/author/index.js @@ -22,7 +22,7 @@ import { AuthorContext } from './context'; */ export const Name = (props) => { - const { tagName: TagName, ...rest } = props; + const { tagName: TagName = 'span', ...rest } = props; /** * @type {Author} @@ -47,7 +47,7 @@ Name.defaultProps = { }; export const FirstName = (props) => { - const { tagName: TagName, ...rest } = props; + const { tagName: TagName = 'span', ...rest } = props; /** * @type {Author} @@ -66,7 +66,7 @@ FirstName.defaultProps = { }; export const LastName = (props) => { - const { tagName: TagName, ...rest } = props; + const { tagName: TagName = 'span', ...rest } = props; /** * @type {Author} diff --git a/components/post-term-list/index.js b/components/post-term-list/index.js index ba024dee..04c41f01 100644 --- a/components/post-term-list/index.js +++ b/components/post-term-list/index.js @@ -11,7 +11,7 @@ import { PostTermContext } from './context'; import { ListItem, TermLink } from './item'; export const PostTermList = (props) => { - const { tagName: TagName, taxonomyName, children, ...rest } = props; + const { tagName: TagName = 'ul', taxonomyName, children, ...rest } = props; const { isEditable } = usePost(); diff --git a/components/post-term-list/item.js b/components/post-term-list/item.js index bdcdaf5d..df44640f 100644 --- a/components/post-term-list/item.js +++ b/components/post-term-list/item.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { PostTermContext } from './context'; export const ListItem = (props) => { - const { tagName: TagName, children, ...rest } = props; + const { tagName: TagName = 'li', children, ...rest } = props; return {children}; }; diff --git a/components/post-title/index.js b/components/post-title/index.js index 237c9ecd..3db54ad6 100644 --- a/components/post-title/index.js +++ b/components/post-title/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { usePost } from '../../hooks'; export const PostTitle = (props) => { - const { tagName: TagName, ...rest } = props; + const { tagName: TagName = 'h1', ...rest } = props; const { postId, postType, isEditable } = usePost(); const [rawTitle = '', setTitle, fullTitle] = useEntityProp( From 7c31096fc6e5fef5d79f8f1da42a5dc7eb24dab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Wed, 22 Feb 2023 08:02:53 +0100 Subject: [PATCH 2/3] add missing inline default prop --- components/post-meta/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/post-meta/index.js b/components/post-meta/index.js index 2c09b216..27a06f74 100644 --- a/components/post-meta/index.js +++ b/components/post-meta/index.js @@ -29,7 +29,7 @@ PostMeta.propTypes = { }; const MetaString = (props) => { - const { metaKey, tagName } = props; + const { metaKey, tagName = 'p' } = props; const [metaValue, setMetaValue] = usePostMetaValue(metaKey); return ; From f92673c2686978ff29c7404eec2cf442a475bcb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Wed, 22 Feb 2023 08:04:39 +0100 Subject: [PATCH 3/3] add missing inline default values --- components/post-date/index.js | 2 +- components/post-excerpt/index.js | 2 +- components/post-primary-term/index.js | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/post-date/index.js b/components/post-date/index.js index 90bf678a..72ab538c 100644 --- a/components/post-date/index.js +++ b/components/post-date/index.js @@ -28,7 +28,7 @@ PostDatePicker.propTypes = { }; export const PostDate = (props) => { - const { placeholder, format, ...rest } = props; + const { placeholder = __('No date set', 'tenup'), format, ...rest } = props; const { postId, postType, isEditable } = usePost(); diff --git a/components/post-excerpt/index.js b/components/post-excerpt/index.js index 321fbe6e..1404a71e 100644 --- a/components/post-excerpt/index.js +++ b/components/post-excerpt/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { usePost } from '../../hooks'; export const PostExcerpt = (props) => { - const { placeholder, ...rest } = props; + const { placeholder = __('Enter excerpt...', 'tenup'), ...rest } = props; const { postId, postType, isEditable } = usePost(); const [rawExcerpt = '', setExcerpt, fullExcerpt] = useEntityProp( diff --git a/components/post-primary-term/index.js b/components/post-primary-term/index.js index d1f10a2c..25485e38 100644 --- a/components/post-primary-term/index.js +++ b/components/post-primary-term/index.js @@ -3,7 +3,12 @@ import PropTypes from 'prop-types'; import { usePrimaryTerm } from '../../hooks'; export const PostPrimaryTerm = (props) => { - const { taxonomyName, placeholder, isLink, ...rest } = props; + const { + taxonomyName = 'category', + placeholder = __('Select a term', 'tenup'), + isLink = true, + ...rest + } = props; const [primaryTerm, isSupportedTaxonomy] = usePrimaryTerm(taxonomyName);