Make the send action configurable
[MAILPOET-6429]
This commit is contained in:
@@ -35,6 +35,11 @@ export function SendButton( { validateContent, isContentInvalid } ) {
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const mailpoetEmailData: MailPoetEmailData = mailpoetEmail;
|
||||||
|
function sendAction() {
|
||||||
|
window.location.href = `admin.php?page=mailpoet-newsletters#/send/${ mailpoetEmailData.id }`;
|
||||||
|
}
|
||||||
|
|
||||||
const [ editorMode ] = useEditorMode();
|
const [ editorMode ] = useEditorMode();
|
||||||
|
|
||||||
const isDisabled =
|
const isDisabled =
|
||||||
@@ -44,7 +49,6 @@ export function SendButton( { validateContent, isContentInvalid } ) {
|
|||||||
isContentInvalid ||
|
isContentInvalid ||
|
||||||
isDirty;
|
isDirty;
|
||||||
|
|
||||||
const mailpoetEmailData: MailPoetEmailData = mailpoetEmail;
|
|
||||||
const label = applyFilters(
|
const label = applyFilters(
|
||||||
'mailpoet_email_editor_send_button_label',
|
'mailpoet_email_editor_send_button_label',
|
||||||
__( 'Send', 'mailpoet' )
|
__( 'Send', 'mailpoet' )
|
||||||
@@ -56,7 +60,11 @@ export function SendButton( { validateContent, isContentInvalid } ) {
|
|||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
recordEvent( 'header_send_button_clicked' );
|
recordEvent( 'header_send_button_clicked' );
|
||||||
if ( validateContent() ) {
|
if ( validateContent() ) {
|
||||||
window.location.href = `admin.php?page=mailpoet-newsletters#/send/${ mailpoetEmailData.id }`;
|
const action = applyFilters(
|
||||||
|
'mailpoet_email_editor_send_action_callback',
|
||||||
|
sendAction
|
||||||
|
) as () => void;
|
||||||
|
action();
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
disabled={ isDisabled }
|
disabled={ isDisabled }
|
||||||
|
Reference in New Issue
Block a user