Store texts as HTML
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<a class="reply" v-if="p.reply">
|
||||
%fa:reply%
|
||||
</a>
|
||||
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i" :class="$style.text"/>
|
||||
<mk-post-html v-if="p.text" ref="text" :text="p.text" :i="os.i" :class="$style.text"/>
|
||||
<a class="rp" v-if="p.repost != null">RP:</a>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
@@ -90,7 +90,8 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
connection: null,
|
||||
connectionId: null
|
||||
connectionId: null,
|
||||
urls: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -118,15 +119,6 @@ export default Vue.extend({
|
||||
},
|
||||
url(): string {
|
||||
return `/@${this.pAcct}/${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() {
|
||||
@@ -168,6 +160,21 @@ export default Vue.extend({
|
||||
(this as any).os.stream.dispose(this.connectionId);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
post: {
|
||||
handler(newPost, oldPost) {
|
||||
if (!oldPost || newPost.text !== oldPost.text) {
|
||||
this.$nextTick(() => {
|
||||
const elements = this.$refs.text.$el.getElementsByTagName('a');
|
||||
|
||||
this.urls = [].filter.call(elements, ({ origin }) => origin !== location.origin)
|
||||
.map(({ href }) => href);
|
||||
});
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
capture(withHandler = false) {
|
||||
if ((this as any).os.isSignedIn) {
|
||||
@@ -389,7 +396,7 @@ export default Vue.extend({
|
||||
font-size 1.1em
|
||||
color #717171
|
||||
|
||||
>>> .quote
|
||||
>>> blockquote
|
||||
margin 8px
|
||||
padding 6px 12px
|
||||
color #aaa
|
||||
|
Reference in New Issue
Block a user