mizzkey/packages/frontend/src/components/page/page.text.vue

25 lines
713 B
Vue
Raw Normal View History

<template>
2023-05-27 04:35:26 +02:00
<div class="_gaps">
<Mfm :text="block.text" :isNote="false" :i="$i"/>
2023-05-27 04:35:26 +02:00
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div>
</template>
2023-05-14 03:50:21 +02:00
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as mfm from 'mfm-js';
2023-05-14 03:50:21 +02:00
import * as Misskey from 'misskey-js';
import { TextBlock } from './block.type';
2021-11-11 18:02:25 +01:00
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
2023-04-01 06:52:07 +02:00
import { $i } from '@/account';
2023-05-14 03:50:21 +02: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>