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(),
|
(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 (
|
return (
|
||||||
<div className="edit-post-header">
|
<div className="edit-post-header">
|
||||||
<div className="edit-post-header__settings">
|
<div className="edit-post-header__settings">
|
||||||
|
<Button
|
||||||
|
isSecondary
|
||||||
|
isLarge
|
||||||
|
onClick={showPreview}
|
||||||
|
isPressed={isPreview}
|
||||||
|
>
|
||||||
|
{__('Preview')}
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
isPrimary
|
isPrimary
|
||||||
isLarge
|
isLarge
|
||||||
|
@@ -136,6 +136,12 @@ export function saveFormFailed(message = undefined) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function showPreview() {
|
||||||
|
return {
|
||||||
|
type: 'SHOW_PREVIEW',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function removeNotice(id) {
|
export function removeNotice(id) {
|
||||||
return {
|
return {
|
||||||
type: 'REMOVE_NOTICE',
|
type: 'REMOVE_NOTICE',
|
||||||
|
@@ -35,6 +35,9 @@ export default {
|
|||||||
getIsFormSaving(state) {
|
getIsFormSaving(state) {
|
||||||
return state.isFormSaving;
|
return state.isFormSaving;
|
||||||
},
|
},
|
||||||
|
getIsPreviewShown(state) {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
getIsCustomFieldSaving(state) {
|
getIsCustomFieldSaving(state) {
|
||||||
return state.isCustomFieldSaving;
|
return state.isCustomFieldSaving;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user