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

30 lines
830 B
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
2023-05-27 02:35:26 +00:00
<div class="_gaps">
<Mfm :text="block.text" :isNote="false" :i="$i"/>
2023-05-27 02:35:26 +00:00
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div>
</template>
2023-05-14 01:50:21 +00:00
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as mfm from 'mfm-js';
2023-05-14 01:50:21 +00:00
import * as Misskey from 'misskey-js';
import { TextBlock } from './block.type';
2023-09-19 07:37:43 +00:00
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
import { $i } from '@/account.js';
2023-05-14 01:50:21 +00: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>