From cbec4229d3648a934ef9dbe23efdd1c8f91ade27 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Feb 2018 23:35:32 +0900 Subject: [PATCH] wip --- .../common/views/components/url-preview.vue | 199 +++++++++--------- .../views/components/timeline-post.vue | 23 +- 2 files changed, 108 insertions(+), 114 deletions(-) diff --git a/src/web/app/common/views/components/url-preview.vue b/src/web/app/common/views/components/url-preview.vue index 88158db84..b84634617 100644 --- a/src/web/app/common/views/components/url-preview.vue +++ b/src/web/app/common/views/components/url-preview.vue @@ -1,126 +1,123 @@ - diff --git a/src/web/app/desktop/views/components/timeline-post.vue b/src/web/app/desktop/views/components/timeline-post.vue index f722ea334..ed0596741 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 @@ %fa:reply% RP: +
@@ -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);