diff --git a/app/components/SimpleEditor/ContainerEditor.js b/app/components/SimpleEditor/ContainerEditor.js index 2a65916a751066e8d220b368e6599cdc67af876c..65ef7f40784d3a71534e360935e962632ca026f2 100644 --- a/app/components/SimpleEditor/ContainerEditor.js +++ b/app/components/SimpleEditor/ContainerEditor.js @@ -48,9 +48,7 @@ class ContainerEditor extends SubstanceContainerEditor { // TODO -- this.props.history is deprecated and gives a warning if (this.props.history) { this.props.history.listenBefore((location, callback) => { - const commandStates = this.getCommandStates() - - if (this.editorSession.hasUnsavedChanges()) { + if (this.props.containerId === 'body' && this.editorSession.hasUnsavedChanges()) { const editor = this.getEditor() editor.send('changesNotSaved') @@ -69,14 +67,11 @@ class ContainerEditor extends SubstanceContainerEditor { // TODO -- review // messes up browser history controlBackButton () { - const commandStates = this.getCommandStates() - if (!commandStates['save']) return - const url = '/books/' + this.props.book.id + '/book-builder' window.removeEventListener('popstate', this.controlBackButton) - if (this.editorSession.hasUnsavedChanges()) { + if (this.props.containerId === 'body' && this.editorSession.hasUnsavedChanges()) { const editor = this.getEditor() window.history.pushState(null, null, document.URL)