Add preview text counter

[MAILPOET-5757]
This commit is contained in:
Pavel Dohnal
2023-11-30 10:08:16 +01:00
committed by Aschepikov
parent 09d5cc7024
commit 7081010e72

View File

@@ -10,6 +10,8 @@ import { __ } from '@wordpress/i18n';
import ReactStringReplace from 'react-string-replace'; import ReactStringReplace from 'react-string-replace';
import { storeName } from '../../store'; import { storeName } from '../../store';
const previewTextMaxLength = 150;
export function DetailsPanel() { export function DetailsPanel() {
const [mailpoetEmailData] = useEntityProp( const [mailpoetEmailData] = useEntityProp(
'postType', 'postType',
@@ -60,6 +62,8 @@ export function DetailsPanel() {
</> </>
); );
const previewTextLength = mailpoetEmailData?.preheader?.length ?? 0;
return ( return (
<PanelBody <PanelBody
title={__('Details', 'mailpoet')} title={__('Details', 'mailpoet')}
@@ -88,6 +92,9 @@ export function DetailsPanel() {
onChange={(value) => updateEmailProperty('preheader', value)} onChange={(value) => updateEmailProperty('preheader', value)}
data-automation-id="email_preview_text" data-automation-id="email_preview_text"
/> />
{previewTextLength}
{'/'}
{previewTextMaxLength}
<div className="mailpoet-settings-panel__help"> <div className="mailpoet-settings-panel__help">
<Text> <Text>
{__( {__(