2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2023-04-23 00:21:38 +00:00
|
|
|
<p v-if="note.cw != null" class="cw">
|
|
|
|
<MkA
|
|
|
|
v-if="!detailed && 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>
|
|
|
|
<Mfm
|
|
|
|
v-if="note.cw != ''"
|
|
|
|
class="text"
|
|
|
|
:text="note.cw"
|
|
|
|
:author="note.user"
|
|
|
|
:i="$i"
|
|
|
|
:custom-emojis="note.emojis"
|
|
|
|
/>
|
|
|
|
</p>
|
2023-04-23 00:22:53 +00:00
|
|
|
<div class="wrmlmaau">
|
|
|
|
<div
|
|
|
|
class="content"
|
|
|
|
:class="{ collapsed, isLong, showContent: note.cw && !showContent }"
|
|
|
|
>
|
2023-04-28 23:28:25 +00:00
|
|
|
<XCwButton ref="cwButton" v-if="note.cw && !showContent" v-model="showContent" :note="note" v-on:keydown="focusFooter" />
|
|
|
|
<div
|
|
|
|
class="body"
|
|
|
|
v-bind="{ 'aria-label': !showContent ? '' : null, 'tabindex': !showContent ? '-1' : null }"
|
|
|
|
>
|
2023-04-23 00:21:38 +00:00
|
|
|
<span v-if="note.deletedAt" style="opacity: 0.5"
|
|
|
|
>({{ i18n.ts.deleted }})</span
|
2023-04-08 00:01:42 +00:00
|
|
|
>
|
2023-04-23 00:21:38 +00:00
|
|
|
<template v-if="!note.cw">
|
|
|
|
<MkA
|
|
|
|
v-if="!detailed && 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"
|
|
|
|
/>
|
2023-04-23 00:22:53 +00:00
|
|
|
<MkA
|
|
|
|
v-if="!detailed && note.renoteId"
|
|
|
|
class="rp"
|
|
|
|
:to="`/notes/${note.renoteId}`"
|
2023-04-23 00:21:38 +00:00
|
|
|
>{{ i18n.ts.quoteAttached }}: ...</MkA
|
2023-04-08 00:01:42 +00:00
|
|
|
>
|
2023-04-23 00:21:38 +00:00
|
|
|
<div v-if="note.files.length > 0" class="files">
|
|
|
|
<XMediaList :media-list="note.files" />
|
|
|
|
</div>
|
2023-04-23 00:22:53 +00:00
|
|
|
<XPoll v-if="note.poll" :note="note" class="poll" />
|
2023-04-23 00:21:38 +00:00
|
|
|
<template v-if="detailed">
|
|
|
|
<MkUrlPreview
|
|
|
|
v-for="url in urls"
|
|
|
|
:key="url"
|
|
|
|
:url="url"
|
|
|
|
:compact="true"
|
|
|
|
:detail="false"
|
|
|
|
class="url-preview"
|
|
|
|
/>
|
2023-04-23 00:22:53 +00:00
|
|
|
<div
|
|
|
|
v-if="note.renote"
|
|
|
|
class="renote"
|
|
|
|
@click.stop="emit('push', note.renote)"
|
|
|
|
>
|
|
|
|
<XNoteSimple :note="note.renote" />
|
2023-04-23 00:21:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2023-04-28 23:28:25 +00:00
|
|
|
<div
|
2023-04-29 01:18:00 +00:00
|
|
|
v-if="note.cw && !showContent"
|
2023-04-28 23:28:25 +00:00
|
|
|
tabindex="0"
|
|
|
|
v-on:focus="cwButton?.focus()"
|
|
|
|
></div>
|
2023-04-23 00:21:38 +00:00
|
|
|
</div>
|
2023-04-28 22:18:09 +00:00
|
|
|
<XShowMoreButton v-if="isLong" v-model="collapsed"></XShowMoreButton>
|
2023-04-28 23:28:25 +00:00
|
|
|
<XCwButton v-if="note.cw && showContent" v-model="showContent" :note="note" />
|
2023-04-08 00:01:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 03:02:10 +00:00
|
|
|
<script lang="ts" setup>
|
2023-04-28 23:28:25 +00:00
|
|
|
import { ref } from "vue";
|
2023-04-08 00:01:42 +00:00
|
|
|
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";
|
2023-04-23 00:21:38 +00:00
|
|
|
import XCwButton from "@/components/MkCwButton.vue";
|
2023-04-08 00:01:42 +00:00
|
|
|
import { extractUrlFromMfm } from "@/scripts/extract-url-from-mfm";
|
|
|
|
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;
|
2023-04-23 00:21:38 +00:00
|
|
|
detailedView?: boolean;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: "push", v): void;
|
2023-04-28 23:28:25 +00:00
|
|
|
(ev: "focusfooter"): void;
|
2022-01-14 03:02:10 +00:00
|
|
|
}>();
|
|
|
|
|
2023-04-28 23:28:25 +00:00
|
|
|
const cwButton = ref<HTMLElement>();
|
2023-04-23 00:22:53 +00:00
|
|
|
const isLong =
|
|
|
|
!props.detailedView &&
|
|
|
|
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-04-08 00:01:42 +00:00
|
|
|
const urls = props.note.text
|
2023-04-23 00:21:38 +00:00
|
|
|
? extractUrlFromMfm(mfm.parse(props.note.text)).slice(0, 5)
|
2023-04-08 00:01:42 +00:00
|
|
|
: null;
|
2023-04-23 00:21:38 +00:00
|
|
|
|
2023-04-23 00:22:53 +00:00
|
|
|
let showContent = $ref(false);
|
2023-04-28 23:28:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
function focusFooter(ev) {
|
|
|
|
if (ev.key == "Tab" && !ev.getModifierState("Shift")) {
|
|
|
|
emit("focusfooter");
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-04-23 00:21:38 +00:00
|
|
|
.reply-icon {
|
|
|
|
display: inline-block;
|
|
|
|
border-radius: 6px;
|
|
|
|
padding: 0.2em 0.2em;
|
|
|
|
margin-right: 0.2em;
|
|
|
|
color: var(--accent);
|
|
|
|
transition: background 0.2s;
|
2023-04-23 00:22:53 +00:00
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2023-04-23 00:21:38 +00:00
|
|
|
background: var(--buttonHoverBg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.cw {
|
|
|
|
cursor: default;
|
|
|
|
display: block;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
margin-bottom: 10px;
|
2020-01-29 19:37:25 +00:00
|
|
|
overflow-wrap: break-word;
|
2023-04-23 00:21:38 +00:00
|
|
|
> .text {
|
|
|
|
margin-right: 8px;
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
2023-04-23 00:21:38 +00:00
|
|
|
}
|
|
|
|
.wrmlmaau {
|
|
|
|
.content {
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
> .body {
|
2023-04-23 00:22:53 +00:00
|
|
|
transition: filter 0.1s;
|
2023-04-23 00:21:38 +00:00
|
|
|
> .rp {
|
|
|
|
margin-left: 4px;
|
|
|
|
font-style: oblique;
|
|
|
|
color: var(--renote);
|
|
|
|
}
|
|
|
|
.reply-icon {
|
|
|
|
display: inline-block;
|
|
|
|
border-radius: 6px;
|
|
|
|
padding: 0.2em 0.2em;
|
|
|
|
margin-right: 0.2em;
|
|
|
|
color: var(--accent);
|
|
|
|
transition: background 0.2s;
|
|
|
|
&:hover,
|
|
|
|
&:focus {
|
|
|
|
background: var(--buttonHoverBg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
> .files {
|
|
|
|
margin-top: 0.4em;
|
|
|
|
margin-bottom: 0.4em;
|
|
|
|
}
|
|
|
|
> .url-preview {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
2023-04-23 00:22:53 +00:00
|
|
|
|
2023-04-23 00:21:38 +00:00
|
|
|
> .poll {
|
|
|
|
font-size: 80%;
|
|
|
|
}
|
2021-11-19 09:56:30 +00:00
|
|
|
|
2023-04-23 00:21:38 +00:00
|
|
|
> .renote {
|
|
|
|
padding-top: 8px;
|
|
|
|
> * {
|
|
|
|
padding: 16px;
|
|
|
|
border: solid 1px var(--renote);
|
|
|
|
border-radius: 8px;
|
|
|
|
transition: background 0.2s;
|
|
|
|
&:hover,
|
|
|
|
&:focus-within {
|
|
|
|
background-color: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-15 19:34:35 +00:00
|
|
|
}
|
2021-11-19 09:56:30 +00:00
|
|
|
|
2023-04-23 00:22:53 +00:00
|
|
|
&.collapsed,
|
|
|
|
&.showContent {
|
2023-04-23 00:21:38 +00:00
|
|
|
position: relative;
|
|
|
|
max-height: calc(9em + 50px);
|
|
|
|
> .body {
|
|
|
|
max-height: inherit;
|
|
|
|
mask: linear-gradient(black calc(100% - 64px), transparent);
|
2023-04-23 00:22:53 +00:00
|
|
|
-webkit-mask: linear-gradient(
|
|
|
|
black calc(100% - 64px),
|
|
|
|
transparent
|
|
|
|
);
|
2023-04-23 00:21:38 +00:00
|
|
|
padding-inline: 50px;
|
|
|
|
margin-inline: -50px;
|
|
|
|
margin-top: -50px;
|
|
|
|
padding-top: 50px;
|
|
|
|
overflow: hidden;
|
2023-04-28 23:28:25 +00:00
|
|
|
user-select: none;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
2023-04-23 00:21:38 +00:00
|
|
|
}
|
|
|
|
&.collapsed > .body {
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
&.showContent {
|
|
|
|
> .body {
|
|
|
|
min-height: 2em;
|
|
|
|
max-height: 5em;
|
|
|
|
filter: blur(4px);
|
2023-04-26 20:03:32 +00:00
|
|
|
:deep(span) {
|
|
|
|
animation: none !important;
|
|
|
|
transform: none !important;
|
|
|
|
}
|
|
|
|
:deep(img) {
|
|
|
|
filter: blur(12px);
|
|
|
|
}
|
2023-04-23 00:21:38 +00:00
|
|
|
}
|
|
|
|
:deep(.fade) {
|
|
|
|
inset: 0;
|
|
|
|
top: 40px;
|
|
|
|
}
|
2021-11-19 09:56:30 +00:00
|
|
|
}
|
2023-04-30 02:38:26 +00:00
|
|
|
|
|
|
|
:deep(.fade) {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
> span {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 0.4em 1em;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
> span {
|
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
:deep(.showLess) {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 1em;
|
|
|
|
position: sticky;
|
|
|
|
bottom: var(--stickyBottom);
|
|
|
|
|
|
|
|
> 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);
|
|
|
|
}
|
2022-08-15 20:28:13 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
</style>
|