Update insert link callback to insert links with new tags

[MAILPOET-6393]
This commit is contained in:
Rostislav Wolny
2025-01-07 15:26:51 +01:00
committed by Aschepikov
parent 80f35169a2
commit c05a2edfba

View File

@ -33,26 +33,24 @@ export const useContentValidation = (): ContentValidationData => {
const { addValidationNotice, hasValidationNotice, removeValidationNotice } =
useValidationNotices();
const { editedContent, editedTemplateContent, defaultTemplateId } =
useSelect( ( mapSelect ) => ( {
const { editedContent, editedTemplateContent, postTemplateId } = useSelect(
( mapSelect ) => ( {
editedContent:
mapSelect( emailEditorStore ).getEditedEmailContent(),
editedTemplateContent:
mapSelect( emailEditorStore ).getTemplateContent(),
defaultTemplateId: mapSelect( coreDataStore ).getDefaultTemplateId(
{
slug: 'email-general',
}
),
} ) );
postTemplateId:
mapSelect( emailEditorStore ).getEditedPostTemplate()?.id,
} )
);
const content = useShallowEqual( editedContent );
const templateContent = useShallowEqual( editedTemplateContent );
const contentLink = `<a href='[link:subscription_unsubscribe_url]'>${ __(
const contentLink = `<a data-link-href='[mailpoet/subscription-unsubscribe-url]' contenteditable='false' style='text-decoration: underline;' class='mailpoet-email-editor__personalization-tags-link'>${ __(
'Unsubscribe',
'mailpoet'
) }</a> | <a href='[link:subscription_manage_url]'>${ __(
) }</a> | <a data-link-href='[mailpoet/subscription-manage-url]' contenteditable='false' style='text-decoration: underline;' class='mailpoet-email-editor__personalization-tags-link'>${ __(
'Manage subscription',
'mailpoet'
) }</a>`;
@ -88,7 +86,7 @@ export const useContentValidation = (): ContentValidationData => {
void dispatch( coreDataStore ).editEntityRecord(
'postType',
'wp_template',
defaultTemplateId,
postTemplateId,
{
content: `
${ editedTemplateContent }
@ -108,7 +106,7 @@ export const useContentValidation = (): ContentValidationData => {
contentBlockId,
hasFooter,
contentLink,
defaultTemplateId,
postTemplateId,
editedTemplateContent,
] );