Fixes #113 Add ability to disable editor preview for a collection
This commit is contained in:
parent
7aa77baea9
commit
881c0b0958
@ -30,6 +30,8 @@ collections: # A list of collections the CMS should be able to edit
|
|||||||
|
|
||||||
- name: "settings"
|
- name: "settings"
|
||||||
label: "Settings"
|
label: "Settings"
|
||||||
|
editor:
|
||||||
|
preview: false
|
||||||
files:
|
files:
|
||||||
- name: "general"
|
- name: "general"
|
||||||
label: "Site Settings"
|
label: "Site Settings"
|
||||||
|
@ -53,9 +53,15 @@ class EntryEditor extends Component {
|
|||||||
const controlClassName = `${ styles.controlPane } ${ this.state.showEventBlocker && styles.blocker }`;
|
const controlClassName = `${ styles.controlPane } ${ this.state.showEventBlocker && styles.blocker }`;
|
||||||
const previewClassName = `${ styles.previewPane } ${ this.state.showEventBlocker && styles.blocker }`;
|
const previewClassName = `${ styles.previewPane } ${ this.state.showEventBlocker && styles.blocker }`;
|
||||||
|
|
||||||
|
const collectionPreviewEnabled = collection.getIn(['editor', 'preview'], true);
|
||||||
|
|
||||||
|
const togglePreviewButton = (
|
||||||
|
<Button className={styles.previewToggle} onClick={this.handleTogglePreview}>Toggle Preview</Button>
|
||||||
|
);
|
||||||
|
|
||||||
const editor = (
|
const editor = (
|
||||||
<div className={controlClassName}>
|
<div className={controlClassName}>
|
||||||
<Button className={styles.previewToggle} onClick={this.handleTogglePreview}>Toggle Preview</Button>
|
{ collectionPreviewEnabled ? togglePreviewButton : null }
|
||||||
<ControlPane
|
<ControlPane
|
||||||
collection={collection}
|
collection={collection}
|
||||||
entry={entry}
|
entry={entry}
|
||||||
@ -97,7 +103,7 @@ class EntryEditor extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.root}>
|
<div className={styles.root}>
|
||||||
{ this.state.previewVisible ? editorWithPreview : editor }
|
{ collectionPreviewEnabled && this.state.previewVisible ? editorWithPreview : editor }
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
<Toolbar
|
<Toolbar
|
||||||
isPersisting={entry.get('isPersisting')}
|
isPersisting={entry.get('isPersisting')}
|
||||||
@ -125,5 +131,4 @@ EntryEditor.propTypes = {
|
|||||||
onCancelEdit: PropTypes.func.isRequired,
|
onCancelEdit: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default EntryEditor;
|
export default EntryEditor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user