2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div class="wrmlmaau" :class="{ collapsed, isLong }">
|
|
|
|
<div class="body">
|
|
|
|
<span v-if="note.deletedAt" style="opacity: 0.5"
|
|
|
|
>({{ i18n.ts.deleted }})</span
|
|
|
|
>
|
|
|
|
<template v-if="!note.cw">
|
|
|
|
<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 &&
|
|
|
|
!note.replyId
|
|
|
|
"
|
|
|
|
:to="`/notes/${note.renoteId}`"
|
|
|
|
class="reply-icon"
|
|
|
|
@click.stop
|
|
|
|
>
|
|
|
|
<i class="ph-quotes ph-bold ph-lg"></i>
|
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
<Mfm
|
|
|
|
v-if="note.text"
|
|
|
|
:text="note.text"
|
|
|
|
:author="note.user"
|
|
|
|
:i="$i"
|
|
|
|
:custom-emojis="note.emojis"
|
|
|
|
/>
|
|
|
|
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`"
|
|
|
|
>{{ i18n.ts.quoteAttached }}: ...</MkA
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<div v-if="note.files.length > 0">
|
|
|
|
<XMediaList :media-list="note.files" />
|
|
|
|
</div>
|
|
|
|
<div v-if="note.poll">
|
|
|
|
<summary>{{ i18n.ts.poll }}</summary>
|
|
|
|
<XPoll :note="note" />
|
|
|
|
</div>
|
|
|
|
<template v-if="detailed">
|
|
|
|
<!-- <div v-if="note.renoteId" class="renote">
|
2023-03-18 01:44:00 +01:00
|
|
|
<XNoteSimple :note="note.renote"/>
|
|
|
|
</div> -->
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkUrlPreview
|
|
|
|
v-for="url in urls"
|
|
|
|
:key="url"
|
|
|
|
:url="url"
|
|
|
|
:compact="true"
|
|
|
|
:detail="false"
|
|
|
|
class="url-preview"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
<button
|
|
|
|
v-if="isLong && collapsed"
|
|
|
|
class="fade _button"
|
|
|
|
@click.stop="collapsed = false"
|
|
|
|
>
|
|
|
|
<span>{{ i18n.ts.showMore }}</span>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="isLong && !collapsed"
|
|
|
|
class="showLess _button"
|
|
|
|
@click.stop="collapsed = true"
|
|
|
|
>
|
|
|
|
<span>{{ i18n.ts.showLess }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 04:02:10 +01:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import {} from "vue";
|
|
|
|
import * as misskey from "calckey-js";
|
|
|
|
import * as mfm from "mfm-js";
|
|
|
|
import XNoteSimple from "@/components/MkNoteSimple.vue";
|
|
|
|
import XMediaList from "@/components/MkMediaList.vue";
|
|
|
|
import XPoll from "@/components/MkPoll.vue";
|
|
|
|
import MkUrlPreview from "@/components/MkUrlPreview.vue";
|
|
|
|
import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
|
|
|
|
import { i18n } from "@/i18n";
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-14 04:02:10 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
note: misskey.entities.Note;
|
2023-03-18 01:44:00 +01:00
|
|
|
parentId?;
|
2023-03-19 08:13:02 +01:00
|
|
|
conversation?;
|
2023-02-17 17:31:48 +01:00
|
|
|
detailed?: boolean;
|
2022-01-14 04:02:10 +01:00
|
|
|
}>();
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const isLong =
|
|
|
|
props.note.cw == null &&
|
|
|
|
props.note.text != null &&
|
|
|
|
(props.note.text.split("\n").length > 9 || props.note.text.length > 500);
|
2022-08-15 22:28:13 +02:00
|
|
|
const collapsed = $ref(props.note.cw == null && isLong);
|
2023-04-08 02:01:42 +02:00
|
|
|
const urls = props.note.text
|
|
|
|
? extractUrlFromMfm(mfm.parse(props.note.text))
|
|
|
|
: null;
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.wrmlmaau {
|
|
|
|
overflow-wrap: break-word;
|
2023-04-08 02:01:42 +02:00
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
> .body {
|
|
|
|
> .rp {
|
|
|
|
margin-left: 4px;
|
|
|
|
font-style: oblique;
|
|
|
|
color: var(--renote);
|
|
|
|
}
|
2023-03-20 21:26:05 +01:00
|
|
|
.reply-icon {
|
|
|
|
display: inline-block;
|
|
|
|
border-radius: 6px;
|
2023-04-08 02:01:42 +02:00
|
|
|
padding: 0.2em 0.2em;
|
|
|
|
margin-right: 0.2em;
|
2023-03-20 21:26:05 +01:00
|
|
|
color: var(--accent);
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: background 0.2s;
|
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2023-03-20 21:26:05 +01:00
|
|
|
background: var(--buttonHoverBg);
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2021-11-19 10:56:30 +01:00
|
|
|
|
2023-02-24 04:03:38 +01:00
|
|
|
> .mk-url-preview {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
|
2021-11-19 10:56:30 +01:00
|
|
|
&.collapsed {
|
|
|
|
position: relative;
|
|
|
|
max-height: 9em;
|
|
|
|
overflow: hidden;
|
2023-01-15 20:34:35 +01: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 10:56:30 +01: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 22:28:13 +02:00
|
|
|
|
|
|
|
&.isLong {
|
|
|
|
> .showLess {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 1em;
|
|
|
|
position: sticky;
|
2023-04-02 23:39:25 +02:00
|
|
|
bottom: var(--stickyBottom);
|
2022-08-15 22:28:13 +02:00
|
|
|
|
|
|
|
> 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 20:37:25 +01:00
|
|
|
}
|
|
|
|
</style>
|