2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2022-08-15 20:28:13 +00:00
|
|
|
<div class="wrmlmaau" :class="{ collapsed, isLong }">
|
2020-01-29 19:37:25 +00:00
|
|
|
<div class="body">
|
2022-07-20 13:24:26 +00:00
|
|
|
<span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deleted }})</span>
|
2023-03-18 00:44:00 +00:00
|
|
|
<template v-if="!note.cw">
|
2023-03-19 07:13:02 +00:00
|
|
|
<MkA v-if="note.replyId" :to="`/notes/${note.replyId}`" class="reply-icon" @click.stop>
|
|
|
|
<i class="ph-arrow-bend-left-up ph-bold ph-lg"></i>
|
|
|
|
</MkA>
|
|
|
|
<MkA v-if="conversation && note.renoteId && note.renoteId != parentId" :to="`/notes/${note.renoteId}`" class="reply-icon" @click.stop>
|
|
|
|
<i class="ph-quotes ph-bold ph-lg"></i>
|
|
|
|
</MkA>
|
2023-03-18 00:44:00 +00:00
|
|
|
</template>
|
2020-12-19 01:55:52 +00:00
|
|
|
<Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i" :custom-emojis="note.emojis"/>
|
2023-01-09 20:49:46 +00:00
|
|
|
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">{{ i18n.ts.quoteAttached }}: ...</MkA>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
2022-08-17 07:29:41 +00:00
|
|
|
<div v-if="note.files.length > 0">
|
2020-10-17 11:12:00 +00:00
|
|
|
<XMediaList :media-list="note.files"/>
|
2022-08-17 07:29:41 +00:00
|
|
|
</div>
|
|
|
|
<div v-if="note.poll">
|
2022-07-20 13:24:26 +00:00
|
|
|
<summary>{{ i18n.ts.poll }}</summary>
|
2020-10-17 11:12:00 +00:00
|
|
|
<XPoll :note="note"/>
|
2022-08-17 07:29:41 +00:00
|
|
|
</div>
|
2023-03-18 00:44:00 +00:00
|
|
|
<template v-if="detailed">
|
|
|
|
<!-- <div v-if="note.renoteId" class="renote">
|
|
|
|
<XNoteSimple :note="note.renote"/>
|
|
|
|
</div> -->
|
|
|
|
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" class="url-preview"/>
|
|
|
|
</template>
|
2023-02-24 01:14:43 +00:00
|
|
|
<button v-if="isLong && collapsed" class="fade _button" @click.stop="collapsed = false">
|
2022-07-20 13:24:26 +00:00
|
|
|
<span>{{ i18n.ts.showMore }}</span>
|
2021-11-19 09:56:30 +00:00
|
|
|
</button>
|
2023-02-24 01:14:43 +00:00
|
|
|
<button v-if="isLong && !collapsed" class="showLess _button" @click.stop="collapsed = true">
|
2022-08-15 20:28:13 +00:00
|
|
|
<span>{{ i18n.ts.showLess }}</span>
|
|
|
|
</button>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-14 03:02:10 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-12-12 03:24:12 +00:00
|
|
|
import * as misskey from 'calckey-js';
|
2023-02-16 22:06:36 +00:00
|
|
|
import * as mfm from 'mfm-js';
|
2023-02-17 16:31:48 +00:00
|
|
|
import XNoteSimple from '@/components/MkNoteSimple.vue';
|
2022-08-30 15:24:33 +00:00
|
|
|
import XMediaList from '@/components/MkMediaList.vue';
|
|
|
|
import XPoll from '@/components/MkPoll.vue';
|
2023-02-16 22:06:36 +00:00
|
|
|
import MkUrlPreview from '@/components/MkUrlPreview.vue';
|
|
|
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
2022-07-20 13:24:26 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-01-14 03:02:10 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
note: misskey.entities.Note;
|
2023-03-18 00:44:00 +00:00
|
|
|
parentId?;
|
2023-03-19 07:13:02 +00:00
|
|
|
conversation?;
|
2023-02-17 16:31:48 +00:00
|
|
|
detailed?: boolean;
|
2022-01-14 03:02:10 +00:00
|
|
|
}>();
|
|
|
|
|
2022-08-15 20:28:13 +00:00
|
|
|
const isLong = (
|
2022-01-14 03:02:10 +00:00
|
|
|
props.note.cw == null && props.note.text != null && (
|
|
|
|
(props.note.text.split('\n').length > 9) ||
|
|
|
|
(props.note.text.length > 500)
|
2022-08-15 20:28:13 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
const collapsed = $ref(props.note.cw == null && isLong);
|
2023-02-16 22:06:36 +00:00
|
|
|
const urls = props.note.text ? extractUrlFromMfm(mfm.parse(props.note.text)) : null;
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.wrmlmaau {
|
|
|
|
overflow-wrap: break-word;
|
2023-02-20 18:30:15 +00:00
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
> .body {
|
|
|
|
|
|
|
|
> .rp {
|
|
|
|
margin-left: 4px;
|
|
|
|
font-style: oblique;
|
|
|
|
color: var(--renote);
|
|
|
|
}
|
|
|
|
}
|
2021-11-19 09:56:30 +00:00
|
|
|
|
2023-02-24 03:03:38 +00:00
|
|
|
> .mk-url-preview {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
|
2021-11-19 09:56:30 +00:00
|
|
|
&.collapsed {
|
|
|
|
position: relative;
|
|
|
|
max-height: 9em;
|
|
|
|
overflow: hidden;
|
2023-01-15 19:34:35 +00:00
|
|
|
> .body {
|
|
|
|
max-height: 9em;
|
|
|
|
mask: linear-gradient(black calc(100% - 64px), transparent);
|
|
|
|
-webkit-mask: linear-gradient(black calc(100% - 64px), transparent);
|
|
|
|
}
|
2021-11-19 09:56:30 +00:00
|
|
|
> .fade {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 64px;
|
|
|
|
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
> span {
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-15 20:28:13 +00:00
|
|
|
|
|
|
|
&.isLong {
|
|
|
|
> .showLess {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 1em;
|
|
|
|
position: sticky;
|
|
|
|
bottom: 1em;
|
|
|
|
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 0 7px 7px var(--bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
</style>
|