Add button with shortcode icon for subject and preheader

[MAILPOET-6354]
This commit is contained in:
Jan Lysý
2024-11-29 15:59:00 +01:00
committed by Aschepikov
parent 99d4c3bcaf
commit 7f2f9ff7ca
2 changed files with 29 additions and 1 deletions

View File

@ -76,6 +76,16 @@
width: 100%; width: 100%;
} }
.mailpoet-settings-panel__personalization-tags-button.components-button.has-icon {
display: inline-block;
height: 14px;
line-height: 14px;
padding: 0 5px;
span {
height: 11px;
}
}
.mailpoet-settings-panel__subject .components-base-control__label { .mailpoet-settings-panel__subject .components-base-control__label {
width: 100%; width: 100%;

View File

@ -1,4 +1,9 @@
import { BaseControl, ExternalLink, PanelBody } from '@wordpress/components'; import {
BaseControl,
Button,
ExternalLink,
PanelBody,
} from '@wordpress/components';
import { useDispatch } from '@wordpress/data'; import { useDispatch } from '@wordpress/data';
import { useEntityProp } from '@wordpress/core-data'; import { useEntityProp } from '@wordpress/core-data';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
@ -10,6 +15,17 @@ import { RichText } from '@wordpress/block-editor';
const previewTextMaxLength = 150; const previewTextMaxLength = 150;
const previewTextRecommendedLength = 80; const previewTextRecommendedLength = 80;
function PersonalizationTagsButton() {
return (
<Button
className="mailpoet-settings-panel__personalization-tags-button"
icon="shortcode"
title={ __( 'Personalization Tags', 'mailpoet' ) }
onClick={ () => {} }
/>
);
}
export function DetailsPanel() { export function DetailsPanel() {
const [ mailpoetEmailData ] = useEntityProp( const [ mailpoetEmailData ] = useEntityProp(
'postType', 'postType',
@ -46,6 +62,7 @@ export function DetailsPanel() {
const subjectLabel = ( const subjectLabel = (
<> <>
<span>{ __( 'Subject', 'mailpoet' ) }</span> <span>{ __( 'Subject', 'mailpoet' ) }</span>
<PersonalizationTagsButton />
<ExternalLink href="https://kb.mailpoet.com/article/215-personalize-newsletter-with-shortcodes#list"> <ExternalLink href="https://kb.mailpoet.com/article/215-personalize-newsletter-with-shortcodes#list">
{ __( 'Shortcode guide', 'mailpoet' ) } { __( 'Shortcode guide', 'mailpoet' ) }
</ExternalLink> </ExternalLink>
@ -77,6 +94,7 @@ export function DetailsPanel() {
const preheaderLabel = ( const preheaderLabel = (
<> <>
<span>{ __( 'Preview text', 'mailpoet' ) }</span> <span>{ __( 'Preview text', 'mailpoet' ) }</span>
<PersonalizationTagsButton />
<span <span
className={ classnames( className={ classnames(
'mailpoet-settings-panel__preview-text-length', 'mailpoet-settings-panel__preview-text-length',