Handle situations where draft should be saved
This commit is contained in:
parent
050266ee39
commit
4a044d067a
|
@ -195,7 +195,8 @@ const PostStatusForm = {
|
||||||
preview: null,
|
preview: null,
|
||||||
previewLoading: false,
|
previewLoading: false,
|
||||||
emojiInputShown: false,
|
emojiInputShown: false,
|
||||||
idempotencyKey: ''
|
idempotencyKey: '',
|
||||||
|
saveInhibited: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -310,9 +311,11 @@ const PostStatusForm = {
|
||||||
this.autoPreview()
|
this.autoPreview()
|
||||||
this.updateIdempotencyKey()
|
this.updateIdempotencyKey()
|
||||||
this.debouncedSaveDraft()
|
this.debouncedSaveDraft()
|
||||||
|
this.saveInhibited = false
|
||||||
},
|
},
|
||||||
clearStatus () {
|
clearStatus () {
|
||||||
const newStatus = this.newStatus
|
const newStatus = this.newStatus
|
||||||
|
this.saveInhibited = true
|
||||||
this.newStatus = {
|
this.newStatus = {
|
||||||
status: '',
|
status: '',
|
||||||
spoilerText: '',
|
spoilerText: '',
|
||||||
|
@ -664,7 +667,7 @@ const PostStatusForm = {
|
||||||
return propsToNative(props)
|
return propsToNative(props)
|
||||||
},
|
},
|
||||||
saveDraft () {
|
saveDraft () {
|
||||||
if (this.newStatus.status) {
|
if (!this.saveInhibited) {
|
||||||
console.debug('Saving status', this.newStatus)
|
console.debug('Saving status', this.newStatus)
|
||||||
this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus })
|
this.$store.dispatch('addOrSaveDraft', { draft: this.newStatus })
|
||||||
.then(id => {
|
.then(id => {
|
||||||
|
|
Loading…
Reference in New Issue