Add preview button

[MAILPOET-2602]
This commit is contained in:
Pavel Dohnal
2020-02-05 15:17:47 +01:00
committed by Jack Kitterhing
parent 9e587bf770
commit 0b41af44f2
3 changed files with 22 additions and 1 deletions

View File

@@ -13,11 +13,23 @@ export default () => {
(select) => select('mailpoet-form-editor').getIsFormSaving(),
[]
);
const { toggleSidebar, saveForm } = useDispatch('mailpoet-form-editor');
const isPreview = useSelect(
(select) => select('mailpoet-form-editor').getIsPreviewShown(),
[]
);
const { toggleSidebar, saveForm, showPreview } = useDispatch('mailpoet-form-editor');
return (
<div className="edit-post-header">
<div className="edit-post-header__settings">
<Button
isSecondary
isLarge
onClick={showPreview}
isPressed={isPreview}
>
{__('Preview')}
</Button>
<Button
isPrimary
isLarge

View File

@@ -136,6 +136,12 @@ export function saveFormFailed(message = undefined) {
};
}
export function showPreview() {
return {
type: 'SHOW_PREVIEW',
};
}
export function removeNotice(id) {
return {
type: 'REMOVE_NOTICE',

View File

@@ -35,6 +35,9 @@ export default {
getIsFormSaving(state) {
return state.isFormSaving;
},
getIsPreviewShown(state) {
return false;
},
getIsCustomFieldSaving(state) {
return state.isCustomFieldSaving;
},