logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

draft_closer.js (957B)


  1. import DialogModal from 'src/components/dialog_modal/dialog_modal.vue'
  2. const DraftCloser = {
  3. data () {
  4. return {
  5. showing: false
  6. }
  7. },
  8. components: {
  9. DialogModal
  10. },
  11. emits: [
  12. 'save',
  13. 'discard'
  14. ],
  15. computed: {
  16. action () {
  17. if (this.$store.getters.mergedConfig.autoSaveDraft) {
  18. return 'save'
  19. } else {
  20. return this.$store.getters.mergedConfig.unsavedPostAction
  21. }
  22. },
  23. shouldConfirm () {
  24. return this.action === 'confirm'
  25. }
  26. },
  27. methods: {
  28. requestClose () {
  29. if (this.shouldConfirm) {
  30. this.showing = true
  31. } else if (this.action === 'save') {
  32. this.save()
  33. } else {
  34. this.discard()
  35. }
  36. },
  37. save () {
  38. this.$emit('save')
  39. this.showing = false
  40. },
  41. discard () {
  42. this.$emit('discard')
  43. this.showing = false
  44. },
  45. cancel () {
  46. this.showing = false
  47. }
  48. }
  49. }
  50. export default DraftCloser