fix: update saved state for page meta

pull/1980/head
NGPixel 5 years ago
parent 144950ea70
commit a75ead44d0

@ -144,7 +144,15 @@ export default {
dialogEditorSelector: false, dialogEditorSelector: false,
dialogUnsaved: false, dialogUnsaved: false,
exitConfirmed: false, exitConfirmed: false,
initContentParsed: '' initContentParsed: '',
savedState: {
description: '',
isPublished: false,
publishEndDate: '',
publishStartDate: '',
tags: '',
title: ''
}
} }
}, },
computed: { computed: {
@ -159,10 +167,10 @@ export default {
this.initContentParsed !== this.$store.get('editor/content'), this.initContentParsed !== this.$store.get('editor/content'),
this.locale !== this.$store.get('page/locale'), this.locale !== this.$store.get('page/locale'),
this.path !== this.$store.get('page/path'), this.path !== this.$store.get('page/path'),
this.title !== this.$store.get('page/title'), this.savedState.title !== this.$store.get('page/title'),
this.description !== this.$store.get('page/description'), this.savedState.description !== this.$store.get('page/description'),
this.tags !== this.$store.get('page/tags'), this.savedState.tags !== this.$store.get('page/tags'),
this.isPublished !== this.$store.get('page/isPublished') this.savedState.isPublished !== this.$store.get('page/isPublished')
], Boolean) ], Boolean)
} }
}, },
@ -186,6 +194,8 @@ export default {
this.$store.commit('page/SET_MODE', 'edit') this.$store.commit('page/SET_MODE', 'edit')
this.setCurrentSavedState()
this.checkoutDateActive = this.checkoutDate this.checkoutDateActive = this.checkoutDate
}, },
mounted() { mounted() {
@ -336,6 +346,7 @@ export default {
} }
this.initContentParsed = this.$store.get('editor/content') this.initContentParsed = this.$store.get('editor/content')
this.setCurrentSavedState()
} catch (err) { } catch (err) {
this.$store.commit('showNotification', { this.$store.commit('showNotification', {
message: err.message, message: err.message,
@ -383,6 +394,16 @@ export default {
window.location.assign(`/${this.$store.get('page/locale')}/${this.$store.get('page/path')}`) window.location.assign(`/${this.$store.get('page/locale')}/${this.$store.get('page/path')}`)
} }
}, 500) }, 500)
},
setCurrentSavedState () {
this.savedState = {
description: this.$store.get('page/description'),
isPublished: this.$store.get('page/isPublished'),
publishEndDate: this.$store.get('page/publishEndDate') || '',
publishStartDate: this.$store.get('page/publishStartDate') || '',
tags: this.$store.get('page/tags'),
title: this.$store.get('page/title')
}
} }
}, },
apollo: { apollo: {

Loading…
Cancel
Save