diff options
author | Louis Chemineau <louis@chmn.me> | 2023-03-22 19:37:49 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2023-03-22 19:45:53 +0100 |
commit | 738204123c9a83d333c64594e4ec8c23bdcb1d7c (patch) | |
tree | f949c2a00a6f9bd0afae35992f836d6235d3b8f8 | |
parent | 14ab49b5c610a929efa17ab27c41f84ccbdf1414 (diff) |
Scroll status into view on reply
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | src/components/TimelinePost.vue | 2 | ||||
-rw-r--r-- | src/views/TimelineSinglePost.vue | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/components/TimelinePost.vue b/src/components/TimelinePost.vue index a14914ba..f86ec610 100644 --- a/src/components/TimelinePost.vue +++ b/src/components/TimelinePost.vue @@ -1,5 +1,5 @@ <template> - <div class="post-content"> + <div class="post-content" :data-social-status="item.id"> <div class="post-header"> <div class="post-author-wrapper" :title="item.account.acct"> <router-link v-if="item.account" diff --git a/src/views/TimelineSinglePost.vue b/src/views/TimelineSinglePost.vue index b0e29dde..af9bcf90 100644 --- a/src/views/TimelineSinglePost.vue +++ b/src/views/TimelineSinglePost.vue @@ -74,7 +74,7 @@ export default { // Make sure to scroll mainPost into view on first load so it is not hidden after the parents. parentsTimeline(_, previousValue) { if (previousValue.length === 0 && this.$refs.socialWrapper.parentElement.scrollTop === 0) { - this.$nextTick(() => this.$refs.mainPost.$el.scrollIntoView()) + this.$nextTick(() => this.$refs.mainPost.$el.scrollIntoView({ behavior: 'smooth', block: 'center' })) } }, }, @@ -91,6 +91,12 @@ export default { }, }) + this.$root.$on('composer-reply', (item) => { + this.$nextTick(() => { + this.$refs.socialWrapper.querySelector(`[data-social-status="${item.id}"]`).scrollIntoView({ behavior: 'smooth', block: 'center' }) + }) + }) + // Fetch information of the related account const response = await this.$store.dispatch(this.serverData.public ? 'fetchPublicAccountInfo' : 'fetchAccountInfo', this.account) // We need to update this.uid because we may have asked info for an account whose domain part was a host-meta, |