Add preview button
[MAILPOET-2602]
This commit is contained in:
committed by
Jack Kitterhing
parent
9e587bf770
commit
0b41af44f2
@@ -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
|
||||
|
@@ -136,6 +136,12 @@ export function saveFormFailed(message = undefined) {
|
||||
};
|
||||
}
|
||||
|
||||
export function showPreview() {
|
||||
return {
|
||||
type: 'SHOW_PREVIEW',
|
||||
};
|
||||
}
|
||||
|
||||
export function removeNotice(id) {
|
||||
return {
|
||||
type: 'REMOVE_NOTICE',
|
||||
|
@@ -35,6 +35,9 @@ export default {
|
||||
getIsFormSaving(state) {
|
||||
return state.isFormSaving;
|
||||
},
|
||||
getIsPreviewShown(state) {
|
||||
return false;
|
||||
},
|
||||
getIsCustomFieldSaving(state) {
|
||||
return state.isCustomFieldSaving;
|
||||
},
|
||||
|
Reference in New Issue
Block a user