2023-07-27 00:31:52 -05:00
|
|
|
<!--
|
2024-02-13 09:59:27 -06:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 00:31:52 -05:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2019-04-28 19:11:57 -05:00
|
|
|
<template>
|
2024-03-18 04:21:27 -05:00
|
|
|
<div class="_gaps" :class="$style.textRoot">
|
2024-01-30 04:53:53 -06:00
|
|
|
<Mfm :text="block.text ?? ''" :isNote="false"/>
|
2024-03-21 04:46:42 -05:00
|
|
|
<div v-if="isEnabledUrlPreview">
|
|
|
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
|
|
|
|
</div>
|
2019-04-28 19:11:57 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-05-13 20:50:21 -05:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineAsyncComponent } from 'vue';
|
2022-12-27 03:29:39 -06:00
|
|
|
import * as mfm from 'mfm-js';
|
2023-05-13 20:50:21 -05:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-09-19 02:37:43 -05:00
|
|
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
2024-03-21 04:46:42 -05:00
|
|
|
import { isEnabledUrlPreview } from '@/instance.js';
|
2019-04-28 19:11:57 -05:00
|
|
|
|
2023-05-13 20:50:21 -05:00
|
|
|
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
|
|
|
|
|
|
|
|
const props = defineProps<{
|
2024-01-30 04:53:53 -06:00
|
|
|
block: Misskey.entities.PageBlock,
|
2023-05-13 20:50:21 -05:00
|
|
|
page: Misskey.entities.Page,
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
|
2019-04-28 19:11:57 -05:00
|
|
|
</script>
|
2024-03-18 04:21:27 -05:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.textRoot {
|
|
|
|
font-size: 1.1rem;
|
|
|
|
}
|
|
|
|
</style>
|