Add preview text counter
[MAILPOET-5757]
This commit is contained in:
@@ -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>
|
||||||
{__(
|
{__(
|
||||||
|
Reference in New Issue
Block a user