Skip to content
Snippets Groups Projects
Commit 98b8aa9f authored by chris's avatar chris Committed by john
Browse files

fix for unsaved changes

parent d0cc8b39
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment