diff --git a/src/blocks/feed-item-content/edit.js b/src/blocks/feed-item-content/edit.js index fbb92d6..ba4d45a 100644 --- a/src/blocks/feed-item-content/edit.js +++ b/src/blocks/feed-item-content/edit.js @@ -15,7 +15,7 @@ import { PanelBody, SelectControl } from '@wordpress/components'; import { decodeEntities } from '@wordpress/html-entities'; import { __ } from '@wordpress/i18n'; -import CustomTagSelect from '../../common/components/custom-tag-select'; +import CustomTagSelect from '../../components/custom-tag-select'; const contentTypeMap = { html: 'content_html', @@ -46,14 +46,19 @@ export default function Edit( { customTag.length === 2 ? custom[ customTag[ 0 ] ][ customTag[ 1 ] ] : false; - const content = customContent - ? contentType === 'htmlNoImg' - ? customContent.replace( /]*>/g, '' ) - : customContent - : context[ `feed-block/item/${ contentTypeMap[ contentType ] }` ]; + console.log( { customContent } ); + const content = + customContent !== false + ? contentType === 'htmlNoImg' + ? customContent.replace( /]*>/g, '' ) + : customContent + : context[ `feed-block/item/${ contentTypeMap[ contentType ] }` ]; let contentElement = (
- { __( '', 'feed-block' ) } + { __( '', 'feed-block' ).replace( + '%s', + customTagname ? customTag[ 1 ] : 'default' + ) }
); if ( content && content !== '' ) { diff --git a/src/blocks/feed-item-content/render.php b/src/blocks/feed-item-content/render.php index dd7f660..a618fa6 100644 --- a/src/blocks/feed-item-content/render.php +++ b/src/blocks/feed-item-content/render.php @@ -8,8 +8,8 @@ */ $contentTypeMap = array( - 'text' => 'content_text', - 'html' => 'content_html', + 'text' => 'content_text', + 'html' => 'content_html', 'htmlNoImg' => 'content_html_noimg', ); @@ -17,7 +17,7 @@ $custom_tagname = $custom_tag ? $custom_tag[1] : false; $custom_content = $custom_tag ? $block->context['feed-block/item/custom'][ $custom_tag[0] ][ $custom_tag[1] ] : false; -$content = $custom_content +$content = $custom_content !== false // Empty string is valid content. ? ( 'htmlNoImg' === $attributes['contentType'] ? preg_replace( '/]*>/g', '', $custom_content ) diff --git a/src/blocks/feed-item-date/edit.js b/src/blocks/feed-item-date/edit.js index 182aef2..9540ed4 100644 --- a/src/blocks/feed-item-date/edit.js +++ b/src/blocks/feed-item-date/edit.js @@ -24,7 +24,7 @@ import { useEntityProp } from '@wordpress/core-data'; import { format } from '@wordpress/date'; import { __ } from '@wordpress/i18n'; -import CustomTagSelect from '../../common/components/custom-tag-select'; +import CustomTagSelect from '../../components/custom-tag-select'; const fmt = new DateFormatter(); diff --git a/src/blocks/feed-item-image/edit.js b/src/blocks/feed-item-image/edit.js index c188cf9..70be56e 100644 --- a/src/blocks/feed-item-image/edit.js +++ b/src/blocks/feed-item-image/edit.js @@ -27,7 +27,7 @@ import { useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { isURL } from '@wordpress/url'; -import CustomTagSelect from '../../common/components/custom-tag-select'; +import CustomTagSelect from '../../components/custom-tag-select'; import DimensionControls from './dimension-controls'; import Overlay from './overlay'; diff --git a/src/blocks/feed-item-summary/edit.js b/src/blocks/feed-item-summary/edit.js index 020aae7..08c09b4 100644 --- a/src/blocks/feed-item-summary/edit.js +++ b/src/blocks/feed-item-summary/edit.js @@ -16,8 +16,8 @@ import { PanelBody, ToggleControl, RangeControl } from '@wordpress/components'; import { decodeEntities } from '@wordpress/html-entities'; import { __ } from '@wordpress/i18n'; -import CustomTagSelect from '../../common/components/custom-tag-select'; -import { trimWords } from '../../common/utils'; +import CustomTagSelect from '../../components/custom-tag-select'; +import { trimWords } from '../../utils/trim-words'; export default function Edit( { attributes: { diff --git a/src/blocks/feed-item-title/edit.js b/src/blocks/feed-item-title/edit.js index 09fac3b..fa4f1d1 100644 --- a/src/blocks/feed-item-title/edit.js +++ b/src/blocks/feed-item-title/edit.js @@ -15,7 +15,7 @@ import { ToggleControl, PanelBody } from '@wordpress/components'; import { decodeEntities } from '@wordpress/html-entities'; import { __ } from '@wordpress/i18n'; -import CustomTagSelect from '../../common/components/custom-tag-select'; +import CustomTagSelect from '../../components/custom-tag-select'; import HeadingLevelDropdown from './heading-level-dropdown'; diff --git a/src/common/components/custom-tag-select.js b/src/components/custom-tag-select.js similarity index 100% rename from src/common/components/custom-tag-select.js rename to src/components/custom-tag-select.js diff --git a/src/common/utils.js b/src/utils/trim-words.js similarity index 100% rename from src/common/utils.js rename to src/utils/trim-words.js