diff options
| author | Henry Jameson <me@hjkos.com> | 2019-10-29 09:36:16 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-10-29 09:36:16 +0200 |
| commit | b66564a30dfadfdd2b216072931576c6c4dcbd61 (patch) | |
| tree | de26f9a87bcaa6d8e576cf33165247f5c66b61af /src/components/post_status_modal/post_status_modal.js | |
| parent | c79b2501d275d8d022c6a9a2810211f606f14cde (diff) | |
| parent | 42f428d90e87315107dd20975548a5bd63dc2d53 (diff) | |
Merge remote-tracking branch 'upstream/develop' into settings-refactor
* upstream/develop: (89 commits)
remove needless ref
show preview popover when hover numbered replies
refactor conditions
do not make too many nested div
add fetchStatus action
refactor status loading logic
split status preview popover into a separate component
uninstall mobile-detect library
listen both events
minor css fix
restrict distance at top side only
set different trigger event in desktop and mobile by default
fix eslint warnings
fix popper go behind the top bar
migrate Popper to v-popover
fix popper go behind the top bar
fix eslint warnings
reset font-size to normal text size using rem
use top placement by default
hide status preview popper when hover popper content
...
Diffstat (limited to 'src/components/post_status_modal/post_status_modal.js')
| -rw-r--r-- | src/components/post_status_modal/post_status_modal.js | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/components/post_status_modal/post_status_modal.js b/src/components/post_status_modal/post_status_modal.js index 1033ba11..b44354db 100644 --- a/src/components/post_status_modal/post_status_modal.js +++ b/src/components/post_status_modal/post_status_modal.js @@ -1,24 +1,43 @@ import PostStatusForm from '../post_status_form/post_status_form.vue' +import Modal from '../modal/modal.vue' +import get from 'lodash/get' const PostStatusModal = { components: { - PostStatusForm + PostStatusForm, + Modal + }, + data () { + return { + resettingForm: false + } }, computed: { isLoggedIn () { return !!this.$store.state.users.currentUser }, - isOpen () { - return this.isLoggedIn && this.$store.state.postStatus.modalActivated + modalActivated () { + return this.$store.state.postStatus.modalActivated + }, + isFormVisible () { + return this.isLoggedIn && !this.resettingForm && this.modalActivated }, params () { return this.$store.state.postStatus.params || {} } }, watch: { - isOpen (val) { + params (newVal, oldVal) { + if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id')) { + this.resettingForm = true + this.$nextTick(() => { + this.resettingForm = false + }) + } + }, + isFormVisible (val) { if (val) { - this.$nextTick(() => this.$el.querySelector('textarea').focus()) + this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus()) } } }, |
