logo

pleroma-fe

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

edit_status_modal.js (1273B)


  1. import EditStatusForm from '../edit_status_form/edit_status_form.vue'
  2. import Modal from '../modal/modal.vue'
  3. import get from 'lodash/get'
  4. import { useEditStatusStore } from 'src/stores/editStatus'
  5. const EditStatusModal = {
  6. components: {
  7. EditStatusForm,
  8. Modal
  9. },
  10. data () {
  11. return {
  12. resettingForm: false
  13. }
  14. },
  15. computed: {
  16. isLoggedIn () {
  17. return !!this.$store.state.users.currentUser
  18. },
  19. modalActivated () {
  20. return useEditStatusStore().modalActivated
  21. },
  22. isFormVisible () {
  23. return this.isLoggedIn && !this.resettingForm && this.modalActivated
  24. },
  25. params () {
  26. return useEditStatusStore().params || {}
  27. }
  28. },
  29. watch: {
  30. params (newVal, oldVal) {
  31. if (get(newVal, 'statusId') !== get(oldVal, 'statusId')) {
  32. this.resettingForm = true
  33. this.$nextTick(() => {
  34. this.resettingForm = false
  35. })
  36. }
  37. },
  38. isFormVisible (val) {
  39. if (val) {
  40. this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus())
  41. }
  42. }
  43. },
  44. methods: {
  45. closeModal () {
  46. this.$refs.editStatusForm.requestClose()
  47. },
  48. doCloseModal () {
  49. useEditStatusStore().closeEditStatusModal()
  50. }
  51. }
  52. }
  53. export default EditStatusModal