Display animation change in preview

[MAILPOET-3088]
This commit is contained in:
Pavel Dohnal
2020-09-10 10:44:27 +02:00
committed by Veljko V
parent ea3b8884f6
commit cdee23417e
2 changed files with 9 additions and 1 deletions

View File

@@ -33,6 +33,14 @@ jQuery(($) => {
if (!width) {
return;
}
const animation = event.data.formSettings?.formPlacement?.[placementName]?.animation;
if (animation !== '') {
previewForm.removeClass((index, className) => (className.match(/(^|\s)mailpoet_form_animation\S+/g) || []).join(' '));
setTimeout(() => previewForm.addClass(`mailpoet_form_animation_${animation}`));
toggleClass(previewForm.prev('.mailpoet_form_popup_overlay'), 'mailpoet_form_overlay_animation', 'mailpoet_form_overlay_animation');
}
const position = event.data.formSettings?.formPlacement?.[placementName]?.position;
// Apply width settings

View File

@@ -89,7 +89,7 @@ jQuery(($) => {
if (animation !== '') {
formDiv.addClass(`mailpoet_form_animation_${animation}`);
formDiv.prev('.mailpoet_form_popup_overlay').addClass(`mailpoet_form_overlay_animation_${animation}`);
formDiv.prev('.mailpoet_form_popup_overlay').addClass(`mailpoet_form_overlay_animation`);
formDiv.prev('.mailpoet_form_popup_overlay').addClass('mailpoet_form_overlay_animation');
}
const background = form.data('background-color');
formDiv.css('background-color', background || 'white');