Prevent changing scroll position when spoiler and warning contents are displayed

This commit is contained in:
AkiraFukushima 2021-10-23 22:02:11 +09:00
parent eaff02510a
commit fe265933f2
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
8 changed files with 63 additions and 6 deletions

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -254,6 +255,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeScrolling', false)
}, 500)
}
}
}

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -270,6 +271,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeScrolling', false)
}, 500)
}
}
}

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -253,6 +254,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Home/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Home/changeScrolling', false)
}, 500)
}
}
}

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -270,6 +271,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Lists/Show/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Lists/Show/changeScrolling', false)
}, 500)
}
}
}

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -252,6 +253,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Local/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Local/changeScrolling', false)
}, 500)
}
}
}

View File

@ -14,6 +14,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectNotification="focusNotification(item)"
@sizeChanged="sizeChanged"
>
</notification>
</DynamicScrollerItem>
@ -229,6 +230,12 @@ export default {
this.focusedId = this.mentions[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Mentions/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Mentions/changeScrolling', false)
}, 500)
}
}
}

View File

@ -15,6 +15,7 @@
@focusPrev="focusPrev"
@focusRight="focusSidebar"
@selectToot="focusToot(item)"
@sizeChanged="sizeChanged"
>
</toot>
</DynamicScrollerItem>
@ -255,6 +256,12 @@ export default {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
break
}
},
sizeChanged() {
this.$store.commit('TimelineSpace/Contents/Public/changeScrolling', true)
setTimeout(() => {
this.$store.commit('TimelineSpace/Contents/Public/changeScrolling', false)
}, 500)
}
}
}

View File

@ -64,10 +64,10 @@
<div class="content-wrapper">
<div class="spoiler" v-show="spoilered">
<span v-html="emojiText(originalMessage.spoiler_text, originalMessage.emojis)"></span>
<el-button v-if="!isShowContent" plain type="primary" size="medium" class="spoil-button" @click="showContent = true">
<el-button v-if="!isShowContent" plain type="primary" size="medium" class="spoil-button" @click="toggleSpoiler">
{{ $t('cards.toot.show_more') }}
</el-button>
<el-button v-else type="primary" size="medium" class="spoil-button" @click="showContent = false">
<el-button v-else type="primary" size="medium" class="spoil-button" @click="toggleSpoiler">
{{ $t('cards.toot.hide') }}
</el-button>
</div>
@ -80,7 +80,7 @@
<Poll v-show="isShowContent" v-if="poll" :poll="poll" @vote="vote" @refresh="refresh"></Poll>
</div>
<div class="attachments">
<el-button v-show="sensitive && !isShowAttachments" class="show-sensitive" type="info" @click="showAttachments = true">
<el-button v-show="sensitive && !isShowAttachments" class="show-sensitive" type="info" @click="toggleCW()">
{{ $t('cards.toot.sensitive') }}
</el-button>
<div v-show="isShowAttachments">
@ -88,7 +88,7 @@
v-show="sensitive && isShowAttachments"
class="hide-sensitive"
type="text"
@click="showAttachments = false"
@click="toggleCW()"
:title="$t('cards.toot.hide')"
>
<icon name="eye" class="hide"></icon>
@ -684,8 +684,8 @@ export default {
break
}
case 'cw':
this.showContent = !this.showContent
this.showAttachments = !this.showAttachments
this.toggleSpoiler()
this.toggleCW()
break
}
},
@ -742,6 +742,14 @@ export default {
},
hideMenu() {
this.openToolMenu = false
},
toggleSpoiler() {
this.showContent = !this.showContent
this.$emit('sizeChanged', true)
},
toggleCW() {
this.showAttachments = !this.showAttachments
this.$emit('sizeChanged', true)
}
}
}