1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-23 19:18:44 +09:00
MisskeyIO/packages/frontend/src/components/page/page.text.vue

41 lines
909 B
Vue
Raw Normal View History

<template>
2019-05-24 03:46:20 +09:00
<div class="mrdgzndn">
<Mfm :text="block.text" :isNote="false" :i="$i"/>
2021-11-19 19:36:12 +09:00
<MkUrlPreview v-for="url in urls" :key="url" :url="url" class="url"/>
</div>
</template>
2023-05-14 10:50:21 +09:00
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as mfm from 'mfm-js';
2023-05-14 10:50:21 +09:00
import * as Misskey from 'misskey-js';
import { TextBlock } from './block.type';
2021-11-12 02:02:25 +09:00
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
2023-04-01 13:52:07 +09:00
import { $i } from '@/account';
2023-05-14 10:50:21 +09:00
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
const props = defineProps<{
block: TextBlock,
page: Misskey.entities.Page,
}>();
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
</script>
<style lang="scss" scoped>
.mrdgzndn {
&:not(:first-child) {
margin-top: 0.5em;
}
2019-05-24 03:46:20 +09:00
&:not(:last-child) {
margin-bottom: 0.5em;
}
> .url {
margin: 0.5em 0;
}
}
</style>