diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-11 23:35:32 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-11 23:35:32 +0900 |
| commit | cbec4229d3648a934ef9dbe23efdd1c8f91ade27 (patch) | |
| tree | 4063a4b57776e9a29410d0372baad1e0b235990b /src/web/app/desktop | |
| parent | wip (diff) | |
| download | misskey-cbec4229d3648a934ef9dbe23efdd1c8f91ade27.tar.gz misskey-cbec4229d3648a934ef9dbe23efdd1c8f91ade27.tar.bz2 misskey-cbec4229d3648a934ef9dbe23efdd1c8f91ade27.zip | |
wip
Diffstat (limited to 'src/web/app/desktop')
| -rw-r--r-- | src/web/app/desktop/views/components/timeline-post.vue | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/web/app/desktop/views/components/timeline-post.vue b/src/web/app/desktop/views/components/timeline-post.vue index f722ea3340..ed05967411 100644 --- a/src/web/app/desktop/views/components/timeline-post.vue +++ b/src/web/app/desktop/views/components/timeline-post.vue @@ -34,6 +34,7 @@ <a class="reply" v-if="p.reply">%fa:reply%</a> <mk-post-html :ast="p.ast" :i="$root.$data.os.i"/> <a class="quote" v-if="p.repost">RP:</a> + <mk-url-preview v-for="url in urls" :url="url" :key="url"/> </div> <div class="media" v-if="p.media"> <mk-images :images="p.media"/> @@ -101,6 +102,15 @@ export default Vue.extend({ }, url(): string { return `/${this.p.user.username}/${this.p.id}`; + }, + urls(): string[] { + if (this.p.ast) { + return this.p.ast + .filter(t => (t.type == 'url' || t.type == 'link') && !t.silent) + .map(t => t.url); + } else { + return null; + } } }, created() { @@ -113,19 +123,6 @@ export default Vue.extend({ if (this.$root.$data.os.isSignedIn) { this.connection.on('_connected_', this.onStreamConnected); } - - if (this.p.text) { - const tokens = this.p.ast; - - // URLをプレビュー - tokens - .filter(t => (t.type == 'url' || t.type == 'link') && !t.silent) - .map(t => { - riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), { - url: t.url - }); - }); - } }, beforeDestroy() { this.decapture(true); |