[Client] Follow api changes and some improvements

This commit is contained in:
syuilo 2017-03-19 15:23:52 +09:00
parent 6271c70d3c
commit c072232e67

View File

@ -2,7 +2,6 @@
<inside-renderer each="{ posts }"></inside-renderer> <inside-renderer each="{ posts }"></inside-renderer>
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
@ -14,8 +13,10 @@
this.on('mount', () => { this.on('mount', () => {
this.api('posts', { this.api('posts', {
limit: 5, limit: 5,
include_reposts: false, repost: false,
include_replies: false reply: false,
media: false,
poll: false
}).then(posts => { }).then(posts => {
this.update({ this.update({
isFetching: false, isFetching: false,
@ -90,8 +91,21 @@
import compile from '../../common/scripts/text-compiler'; import compile from '../../common/scripts/text-compiler';
this.on('mount', () => { this.on('mount', () => {
const text = compile(this.ast); const html = compile(this.ast);
this.refs.text.innerHTML = text; this.refs.text.innerHTML = html;
this.refs.text.children.forEach(e => {
if (e.tagName == 'MK-URL') riot.mount(e);
});
// URLをプレビュー
this.ast
.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
});
});
}); });
</script> </script>
</inside-renderer> </inside-renderer>