diff --git a/example/config.yml b/example/config.yml index 8cd21fb0..8bbad3d4 100644 --- a/example/config.yml +++ b/example/config.yml @@ -30,6 +30,8 @@ collections: # A list of collections the CMS should be able to edit - name: "settings" label: "Settings" + editor: + preview: false files: - name: "general" label: "Site Settings" diff --git a/src/components/EntryEditor/EntryEditor.js b/src/components/EntryEditor/EntryEditor.js index 17091961..34e46641 100644 --- a/src/components/EntryEditor/EntryEditor.js +++ b/src/components/EntryEditor/EntryEditor.js @@ -53,9 +53,15 @@ class EntryEditor extends Component { const controlClassName = `${ styles.controlPane } ${ this.state.showEventBlocker && styles.blocker }`; const previewClassName = `${ styles.previewPane } ${ this.state.showEventBlocker && styles.blocker }`; + const collectionPreviewEnabled = collection.getIn(['editor', 'preview'], true); + + const togglePreviewButton = ( + + ); + const editor = (
- + { collectionPreviewEnabled ? togglePreviewButton : null } - { this.state.previewVisible ? editorWithPreview : editor } + { collectionPreviewEnabled && this.state.previewVisible ? editorWithPreview : editor }