Fix Media List in CW Content (#6099)

This commit is contained in:
tamaina 2020-04-16 01:04:21 +09:00 committed by GitHub
parent fa75b40dfd
commit d02e14cb94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -34,9 +34,7 @@ export default Vue.extend({
default: false default: false
}, },
// specify the parent element // specify the parent element
parentElement: { parentElement: {}
type: Object
}
}, },
data() { data() {
return { return {
@ -69,7 +67,7 @@ export default Vue.extend({
if (this.$refs.gridOuter) { if (this.$refs.gridOuter) {
let height = 287; let height = 287;
const parent = this.$props.parentElement || this.$parent.$el; const parent = this.parentElement || this.$parent.$el;
if (this.$refs.gridOuter.clientHeight) { if (this.$refs.gridOuter.clientHeight) {
height = this.$refs.gridOuter.clientHeight; height = this.$refs.gridOuter.clientHeight;
@ -83,6 +81,11 @@ export default Vue.extend({
} }
}); });
} }
},
watch: {
parentElement() {
this.size();
}
} }
}); });
</script> </script>

View file

@ -33,7 +33,7 @@
<mk-avatar class="avatar" :user="appearNote.user"/> <mk-avatar class="avatar" :user="appearNote.user"/>
<div class="main"> <div class="main">
<x-note-header class="header" :note="appearNote" :mini="true"/> <x-note-header class="header" :note="appearNote" :mini="true"/>
<div class="body" v-if="appearNote.deletedAt == null"> <div class="body" v-if="appearNote.deletedAt == null" ref="noteBody">
<p v-if="appearNote.cw != null" class="cw"> <p v-if="appearNote.cw != null" class="cw">
<mfm v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" /> <mfm v-if="appearNote.cw != ''" class="text" :text="appearNote.cw" :author="appearNote.user" :i="$store.state.i" :custom-emojis="appearNote.emojis" />
<x-cw-button v-model="showContent" :note="appearNote"/> <x-cw-button v-model="showContent" :note="appearNote"/>
@ -46,7 +46,7 @@
<a class="rp" v-if="appearNote.renote != null">RN:</a> <a class="rp" v-if="appearNote.renote != null">RN:</a>
</div> </div>
<div class="files" v-if="appearNote.files.length > 0"> <div class="files" v-if="appearNote.files.length > 0">
<x-media-list :media-list="appearNote.files"/> <x-media-list :media-list="appearNote.files" :parent-element="noteBody"/>
</div> </div>
<x-poll v-if="appearNote.poll" :note="appearNote" ref="pollViewer"/> <x-poll v-if="appearNote.poll" :note="appearNote" ref="pollViewer"/>
<mk-url-preview v-for="url in urls" :url="url" :key="url" :compact="true" class="url-preview"/> <mk-url-preview v-for="url in urls" :url="url" :key="url" :compact="true" class="url-preview"/>
@ -142,6 +142,7 @@ export default Vue.extend({
replies: [], replies: [],
showContent: false, showContent: false,
hideThisNote: false, hideThisNote: false,
noteBody: this.$refs.noteBody,
faEdit, faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan faEdit, faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan
}; };
}, },
@ -254,6 +255,8 @@ export default Vue.extend({
if (this.$store.getters.isSignedIn) { if (this.$store.getters.isSignedIn) {
this.connection.on('_connected_', this.onStreamConnected); this.connection.on('_connected_', this.onStreamConnected);
} }
this.noteBody = this.$refs.noteBody
}, },
beforeDestroy() { beforeDestroy() {