a bit clearer draft editing flow, partially divorced menu-item from list-item
This commit is contained in:
parent
8657c820bd
commit
68e8a24f18
8 changed files with 74 additions and 32 deletions
|
|
@ -3,6 +3,7 @@ import EditStatusForm from 'src/components/edit_status_form/edit_status_form.vue
|
|||
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
|
||||
import StatusContent from 'src/components/status_content/status_content.vue'
|
||||
import Gallery from 'src/components/gallery/gallery.vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const Draft = {
|
||||
components: {
|
||||
|
|
@ -19,8 +20,8 @@ const Draft = {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
console.log('DRAFT', this.draft)
|
||||
return {
|
||||
referenceDraft: cloneDeep(this.draft),
|
||||
editing: false,
|
||||
showingConfirmDialog: false
|
||||
}
|
||||
|
|
@ -35,6 +36,11 @@ const Draft = {
|
|||
return {}
|
||||
}
|
||||
},
|
||||
safeToSave () {
|
||||
return this.draft.status ||
|
||||
this.draft.files?.length ||
|
||||
this.draft.hasPoll
|
||||
},
|
||||
postStatusFormProps () {
|
||||
return {
|
||||
draftId: this.draft.id,
|
||||
|
|
@ -48,7 +54,6 @@ const Draft = {
|
|||
return this.$store.getters.mergedConfig.collapseMessageWithSubject
|
||||
},
|
||||
nsfwClickthrough () {
|
||||
console.log(this.draft)
|
||||
if (!this.draft.nsfw) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -58,6 +63,16 @@ const Draft = {
|
|||
return true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
editing (newVal) {
|
||||
if (newVal) return
|
||||
if (this.safeToSave) {
|
||||
this.$store.dispatch('addOrSaveDraft', { draft: this.draft })
|
||||
} else {
|
||||
this.$store.dispatch('addOrSaveDraft', { draft: this.referenceDraft })
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleEditing () {
|
||||
this.editing = !this.editing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue