2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-05-21 16:10:48 +02:00
|
|
|
<div :aria-label="accessibleLabel" v-if="!muted.muted" v-show="!isDeleted" ref="el" v-hotkey="keymap"
|
|
|
|
v-size="{ max: [500, 450, 350, 300] }" class="tkcbzcuz note-container" :tabindex="!isDeleted ? '-1' : null"
|
|
|
|
:class="{ renote: isRenote }">
|
|
|
|
<MkNoteSub v-if="appearNote.reply && !detailedView" :note="appearNote.reply" class="reply-to" />
|
2023-04-23 02:21:38 +02:00
|
|
|
<div v-if="!detailedView" class="note-context" @click="noteClick">
|
2023-04-08 02:01:42 +02:00
|
|
|
<div class="line"></div>
|
|
|
|
<div v-if="appearNote._prId_" class="info">
|
|
|
|
<i class="ph-megaphone-simple-bold ph-lg"></i>
|
|
|
|
{{ i18n.ts.promotion
|
|
|
|
}}<button class="_textButton hide" @click.stop="readPromo()">
|
|
|
|
{{ i18n.ts.hideThisNote }}
|
|
|
|
<i class="ph-x ph-bold ph-lg"></i>
|
2023-01-21 20:36:05 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div v-if="appearNote._featuredId_" class="info">
|
|
|
|
<i class="ph-lightning ph-bold ph-lg"></i>
|
|
|
|
{{ i18n.ts.featured }}
|
2023-01-05 17:08:23 +01:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div v-if="pinned" class="info">
|
|
|
|
<i class="ph-push-pin ph-bold ph-lg"></i
|
|
|
|
>{{ i18n.ts.pinnedNote }}
|
|
|
|
</div>
|
|
|
|
<div v-if="isRenote" class="renote">
|
|
|
|
<i class="ph-repeat ph-bold ph-lg"></i>
|
|
|
|
<I18n :src="i18n.ts.renotedBy" tag="span">
|
|
|
|
<template #user>
|
|
|
|
<MkA
|
|
|
|
v-user-preview="note.userId"
|
|
|
|
class="name"
|
|
|
|
:to="userPage(note.user)"
|
|
|
|
@click.stop
|
|
|
|
>
|
|
|
|
<MkUserName :user="note.user" />
|
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
</I18n>
|
|
|
|
<div class="info">
|
|
|
|
<button
|
|
|
|
ref="renoteTime"
|
|
|
|
class="_button time"
|
|
|
|
@click.stop="showRenoteMenu()"
|
|
|
|
>
|
|
|
|
<i
|
|
|
|
v-if="isMyRenote"
|
|
|
|
class="ph-dots-three-outline ph-bold ph-lg dropdownIcon"
|
|
|
|
></i>
|
|
|
|
<MkTime :time="note.createdAt" />
|
|
|
|
</button>
|
|
|
|
<MkVisibility :note="note" />
|
|
|
|
</div>
|
2023-01-05 17:08:23 +01:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</div>
|
|
|
|
<article
|
|
|
|
class="article"
|
|
|
|
@contextmenu.stop="onContextmenu"
|
|
|
|
@click="noteClick"
|
|
|
|
>
|
|
|
|
<div class="main">
|
|
|
|
<div class="header-container">
|
|
|
|
<MkAvatar class="avatar" :user="appearNote.user" />
|
|
|
|
<XNoteHeader
|
|
|
|
class="header"
|
|
|
|
:note="appearNote"
|
|
|
|
:mini="true"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="body">
|
2023-04-23 02:21:38 +02:00
|
|
|
<MkSubNoteContent
|
|
|
|
class="text"
|
2023-05-07 20:38:39 +02:00
|
|
|
:note="appearNote"
|
2023-04-23 02:21:38 +02:00
|
|
|
:detailed="true"
|
|
|
|
:detailedView="detailedView"
|
|
|
|
:parentId="appearNote.parentId"
|
|
|
|
@push="(e) => router.push(notePage(e))"
|
2023-04-29 01:28:25 +02:00
|
|
|
@focusfooter="footerEl.focus()"
|
2023-04-23 02:21:38 +02:00
|
|
|
></MkSubNoteContent>
|
2023-04-23 02:22:53 +02:00
|
|
|
<div v-if="translating || translation" class="translation">
|
2023-04-23 02:21:38 +02:00
|
|
|
<MkLoading v-if="translating" mini />
|
|
|
|
<div v-else class="translated">
|
|
|
|
<b
|
|
|
|
>{{
|
|
|
|
i18n.t("translatedFrom", {
|
|
|
|
x: translation.sourceLang,
|
|
|
|
})
|
|
|
|
}}:
|
|
|
|
</b>
|
2023-04-08 02:01:42 +02:00
|
|
|
<Mfm
|
2023-04-23 02:21:38 +02:00
|
|
|
:text="translation.text"
|
2023-04-08 02:01:42 +02:00
|
|
|
:author="appearNote.user"
|
|
|
|
:i="$i"
|
|
|
|
:custom-emojis="appearNote.emojis"
|
|
|
|
/>
|
2021-08-15 13:26:44 +02:00
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
2023-05-19 19:02:41 +02:00
|
|
|
</div>
|
|
|
|
<div v-if="detailedView" class="info">
|
|
|
|
<MkA class="created-at" :to="notePage(appearNote)">
|
|
|
|
<MkTime :time="appearNote.createdAt" mode="absolute" />
|
|
|
|
</MkA>
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkA
|
|
|
|
v-if="appearNote.channel && !inChannel"
|
|
|
|
class="channel"
|
|
|
|
:to="`/channels/${appearNote.channel.id}`"
|
|
|
|
@click.stop
|
|
|
|
><i class="ph-television ph-bold ph-lg"></i>
|
|
|
|
{{ appearNote.channel.name }}</MkA
|
|
|
|
>
|
|
|
|
</div>
|
2023-04-29 01:28:25 +02:00
|
|
|
<footer ref="footerEl" class="footer" @click.stop tabindex="-1">
|
2023-04-08 02:01:42 +02:00
|
|
|
<XReactionsViewer
|
2023-04-20 04:53:28 +02:00
|
|
|
v-if="enableEmojiReactions"
|
2023-04-08 02:01:42 +02:00
|
|
|
ref="reactionsViewer"
|
|
|
|
:note="appearNote"
|
|
|
|
/>
|
|
|
|
<button
|
|
|
|
v-tooltip.noDelay.bottom="i18n.ts.reply"
|
|
|
|
class="button _button"
|
|
|
|
@click="reply()"
|
|
|
|
>
|
|
|
|
<i class="ph-arrow-u-up-left ph-bold ph-lg"></i>
|
2023-05-20 00:41:59 +02:00
|
|
|
<template
|
|
|
|
v-if="appearNote.repliesCount > 0 && !detailedView"
|
|
|
|
>
|
2023-04-08 02:01:42 +02:00
|
|
|
<p class="count">{{ appearNote.repliesCount }}</p>
|
|
|
|
</template>
|
2020-12-30 01:58:57 +01:00
|
|
|
</button>
|
2023-04-08 02:01:42 +02:00
|
|
|
<XRenoteButton
|
|
|
|
ref="renoteButton"
|
|
|
|
class="button"
|
|
|
|
:note="appearNote"
|
|
|
|
:count="appearNote.renoteCount"
|
2023-05-19 19:02:41 +02:00
|
|
|
:detailedView="detailedView"
|
2023-04-08 02:01:42 +02:00
|
|
|
/>
|
2023-04-20 04:53:28 +02:00
|
|
|
<XStarButtonNoEmoji
|
|
|
|
v-if="!enableEmojiReactions"
|
|
|
|
class="button"
|
|
|
|
:note="appearNote"
|
|
|
|
:count="
|
|
|
|
Object.values(appearNote.reactions).reduce(
|
|
|
|
(partialSum, val) => partialSum + val,
|
|
|
|
0
|
|
|
|
)
|
|
|
|
"
|
|
|
|
:reacted="appearNote.myReaction != null"
|
|
|
|
/>
|
2023-04-08 02:01:42 +02:00
|
|
|
<XStarButton
|
2023-04-20 04:53:28 +02:00
|
|
|
v-if="
|
|
|
|
enableEmojiReactions &&
|
|
|
|
appearNote.myReaction == null
|
|
|
|
"
|
2023-04-08 02:01:42 +02:00
|
|
|
ref="starButton"
|
|
|
|
class="button"
|
|
|
|
:note="appearNote"
|
|
|
|
/>
|
|
|
|
<button
|
2023-04-20 04:53:28 +02:00
|
|
|
v-if="
|
|
|
|
enableEmojiReactions &&
|
|
|
|
appearNote.myReaction == null
|
|
|
|
"
|
2023-04-08 02:01:42 +02:00
|
|
|
ref="reactButton"
|
|
|
|
v-tooltip.noDelay.bottom="i18n.ts.reaction"
|
|
|
|
class="button _button"
|
|
|
|
@click="react()"
|
|
|
|
>
|
|
|
|
<i class="ph-smiley ph-bold ph-lg"></i>
|
2022-08-01 10:55:24 +02:00
|
|
|
</button>
|
2023-04-08 02:01:42 +02:00
|
|
|
<button
|
2023-04-20 04:53:28 +02:00
|
|
|
v-if="
|
|
|
|
enableEmojiReactions &&
|
|
|
|
appearNote.myReaction != null
|
|
|
|
"
|
2023-04-08 02:01:42 +02:00
|
|
|
ref="reactButton"
|
|
|
|
class="button _button reacted"
|
|
|
|
@click="undoReact(appearNote)"
|
|
|
|
>
|
|
|
|
<i class="ph-minus ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<XQuoteButton class="button" :note="appearNote" />
|
|
|
|
<button
|
|
|
|
ref="menuButton"
|
|
|
|
v-tooltip.noDelay.bottom="i18n.ts.more"
|
|
|
|
class="button _button"
|
|
|
|
@click="menu()"
|
|
|
|
>
|
|
|
|
<i class="ph-dots-three-outline ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
</footer>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</article>
|
|
|
|
</div>
|
2023-05-10 23:44:08 +02:00
|
|
|
<button v-else class="muted _button" @click="muted.muted = false">
|
2023-05-04 07:13:13 +02:00
|
|
|
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
|
2023-04-08 02:01:42 +02:00
|
|
|
<template #name>
|
|
|
|
<MkA
|
2023-05-05 03:38:56 +02:00
|
|
|
v-user-preview="note.userId"
|
2023-04-08 02:01:42 +02:00
|
|
|
class="name"
|
2023-05-05 03:38:56 +02:00
|
|
|
:to="userPage(note.user)"
|
2023-04-08 02:01:42 +02:00
|
|
|
>
|
2023-05-05 03:38:56 +02:00
|
|
|
<MkUserName :user="note.user" />
|
2023-04-08 02:01:42 +02:00
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
<template #reason>
|
|
|
|
<b class="_blur_text">{{ muted.matched.join(", ") }}</b>
|
|
|
|
</template>
|
|
|
|
</I18n>
|
2023-05-10 23:44:08 +02:00
|
|
|
</button>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 02:25:51 +01:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import { computed, inject, onMounted, onUnmounted, reactive, ref } from "vue";
|
|
|
|
import * as mfm from "mfm-js";
|
|
|
|
import type { Ref } from "vue";
|
|
|
|
import type * as misskey from "calckey-js";
|
|
|
|
import MkNoteSub from "@/components/MkNoteSub.vue";
|
2023-04-23 02:21:38 +02:00
|
|
|
import MkSubNoteContent from "./MkSubNoteContent.vue";
|
2023-04-08 02:01:42 +02:00
|
|
|
import XNoteHeader from "@/components/MkNoteHeader.vue";
|
|
|
|
import XNoteSimple from "@/components/MkNoteSimple.vue";
|
|
|
|
import XMediaList from "@/components/MkMediaList.vue";
|
|
|
|
import XCwButton from "@/components/MkCwButton.vue";
|
|
|
|
import XPoll from "@/components/MkPoll.vue";
|
|
|
|
import XRenoteButton from "@/components/MkRenoteButton.vue";
|
|
|
|
import XReactionsViewer from "@/components/MkReactionsViewer.vue";
|
|
|
|
import XStarButton from "@/components/MkStarButton.vue";
|
2023-04-20 04:53:28 +02:00
|
|
|
import XStarButtonNoEmoji from "@/components/MkStarButtonNoEmoji.vue";
|
2023-04-08 02:01:42 +02:00
|
|
|
import XQuoteButton from "@/components/MkQuoteButton.vue";
|
|
|
|
import MkUrlPreview from "@/components/MkUrlPreview.vue";
|
|
|
|
import MkVisibility from "@/components/MkVisibility.vue";
|
|
|
|
import { pleaseLogin } from "@/scripts/please-login";
|
|
|
|
import { focusPrev, focusNext } from "@/scripts/focus";
|
2023-05-04 07:20:06 +02:00
|
|
|
import { getWordSoftMute } from "@/scripts/check-word-mute";
|
2023-04-08 02:01:42 +02:00
|
|
|
import { useRouter } from "@/router";
|
|
|
|
import { userPage } from "@/filters/user";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { defaultStore, noteViewInterruptors } from "@/store";
|
|
|
|
import { reactionPicker } from "@/scripts/reaction-picker";
|
|
|
|
import { $i } from "@/account";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { getNoteMenu } from "@/scripts/get-note-menu";
|
|
|
|
import { useNoteCapture } from "@/scripts/use-note-capture";
|
|
|
|
import { notePage } from "@/filters/note";
|
|
|
|
import { deepClone } from "@/scripts/clone";
|
2022-08-17 08:53:47 +02:00
|
|
|
|
|
|
|
const router = useRouter();
|
2022-01-14 02:25:51 +01:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
note: misskey.entities.Note;
|
|
|
|
pinned?: boolean;
|
2023-04-23 02:21:38 +02:00
|
|
|
detailedView?: boolean;
|
2022-01-14 02:25:51 +01:00
|
|
|
}>();
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const inChannel = inject("inChannel", null);
|
2022-01-14 02:25:51 +01:00
|
|
|
|
2022-11-17 01:31:07 +01:00
|
|
|
let note = $ref(deepClone(props.note));
|
2022-03-04 17:22:57 +01:00
|
|
|
|
2023-05-04 07:13:13 +02:00
|
|
|
const softMuteReasonI18nSrc = (what?: string) => {
|
2023-05-04 07:41:18 +02:00
|
|
|
if (what === "note") return i18n.ts.userSaysSomethingReason;
|
|
|
|
if (what === "reply") return i18n.ts.userSaysSomethingReasonReply;
|
|
|
|
if (what === "renote") return i18n.ts.userSaysSomethingReasonRenote;
|
|
|
|
if (what === "quote") return i18n.ts.userSaysSomethingReasonQuote;
|
2023-05-04 07:13:13 +02:00
|
|
|
|
|
|
|
// I don't think here is reachable, but just in case
|
|
|
|
return i18n.ts.userSaysSomething;
|
2023-05-04 07:41:18 +02:00
|
|
|
};
|
2023-05-04 07:13:13 +02:00
|
|
|
|
2022-03-04 17:22:57 +01:00
|
|
|
// plugin
|
|
|
|
if (noteViewInterruptors.length > 0) {
|
|
|
|
onMounted(async () => {
|
2022-11-17 01:31:07 +01:00
|
|
|
let result = deepClone(note);
|
2022-03-04 17:22:57 +01:00
|
|
|
for (const interruptor of noteViewInterruptors) {
|
|
|
|
result = await interruptor.handler(result);
|
|
|
|
}
|
|
|
|
note = result;
|
|
|
|
});
|
|
|
|
}
|
2022-02-11 13:35:28 +01:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const isRenote =
|
2022-02-11 13:35:28 +01:00
|
|
|
note.renote != null &&
|
|
|
|
note.text == null &&
|
|
|
|
note.fileIds.length === 0 &&
|
2023-04-08 02:01:42 +02:00
|
|
|
note.poll == null;
|
2022-01-14 02:25:51 +01:00
|
|
|
|
|
|
|
const el = ref<HTMLElement>();
|
2023-04-30 22:27:27 +02:00
|
|
|
const footerEl = ref<HTMLElement>();
|
2022-01-14 02:25:51 +01:00
|
|
|
const menuButton = ref<HTMLElement>();
|
2022-10-26 05:20:41 +02:00
|
|
|
const starButton = ref<InstanceType<typeof XStarButton>>();
|
2022-01-14 02:25:51 +01:00
|
|
|
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
|
|
|
const renoteTime = ref<HTMLElement>();
|
|
|
|
const reactButton = ref<HTMLElement>();
|
2023-04-08 02:01:42 +02:00
|
|
|
let appearNote = $computed(() =>
|
|
|
|
isRenote ? (note.renote as misskey.entities.Note) : note
|
|
|
|
);
|
|
|
|
const isMyRenote = $i && $i.id === note.userId;
|
2022-01-14 02:25:51 +01:00
|
|
|
const showContent = ref(false);
|
|
|
|
const isDeleted = ref(false);
|
2023-05-05 02:46:47 +02:00
|
|
|
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
2022-01-14 02:25:51 +01:00
|
|
|
const translation = ref(null);
|
|
|
|
const translating = ref(false);
|
2023-04-20 04:53:28 +02:00
|
|
|
const enableEmojiReactions = defaultStore.state.enableEmojiReactions;
|
2022-01-14 02:25:51 +01:00
|
|
|
|
|
|
|
const keymap = {
|
2023-04-08 02:01:42 +02:00
|
|
|
r: () => reply(true),
|
|
|
|
"e|a|plus": () => react(true),
|
|
|
|
q: () => renoteButton.value.renote(true),
|
2023-04-29 01:06:21 +02:00
|
|
|
"up|k": focusBefore,
|
|
|
|
"down|j": focusAfter,
|
2023-04-08 02:01:42 +02:00
|
|
|
esc: blur,
|
|
|
|
"m|o": () => menu(true),
|
|
|
|
s: () => showContent.value !== showContent.value,
|
2022-01-14 02:25:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
useNoteCapture({
|
|
|
|
rootEl: el,
|
2022-02-11 13:35:28 +01:00
|
|
|
note: $$(appearNote),
|
2022-02-11 14:14:14 +01:00
|
|
|
isDeletedRef: isDeleted,
|
2022-01-14 02:25:51 +01:00
|
|
|
});
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-01-14 02:25:51 +01:00
|
|
|
function reply(viaKeyboard = false): void {
|
|
|
|
pleaseLogin();
|
2023-04-08 02:01:42 +02:00
|
|
|
os.post(
|
|
|
|
{
|
|
|
|
reply: appearNote,
|
|
|
|
animation: !viaKeyboard,
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
focus();
|
|
|
|
}
|
|
|
|
);
|
2022-01-14 02:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function react(viaKeyboard = false): void {
|
|
|
|
pleaseLogin();
|
|
|
|
blur();
|
2023-04-08 02:01:42 +02:00
|
|
|
reactionPicker.show(
|
|
|
|
reactButton.value,
|
|
|
|
(reaction) => {
|
|
|
|
os.api("notes/reactions/create", {
|
|
|
|
noteId: appearNote.id,
|
|
|
|
reaction: reaction,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
focus();
|
|
|
|
}
|
|
|
|
);
|
2022-01-14 02:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function undoReact(note): void {
|
|
|
|
const oldReaction = note.myReaction;
|
|
|
|
if (!oldReaction) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
os.api("notes/reactions/delete", {
|
2022-06-05 05:26:36 +02:00
|
|
|
noteId: note.id,
|
2022-01-14 02:25:51 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
const currentClipPage = inject<Ref<misskey.entities.Clip> | null>(
|
|
|
|
"currentClipPage",
|
|
|
|
null
|
|
|
|
);
|
2022-06-18 11:27:09 +02:00
|
|
|
|
2022-01-18 13:35:57 +01:00
|
|
|
function onContextmenu(ev: MouseEvent): void {
|
2022-01-14 02:25:51 +01:00
|
|
|
const isLink = (el: HTMLElement) => {
|
2023-04-08 02:01:42 +02:00
|
|
|
if (el.tagName === "A") return true;
|
2022-01-14 02:25:51 +01:00
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2022-01-14 02:25:51 +01:00
|
|
|
};
|
2022-01-18 13:35:57 +01:00
|
|
|
if (isLink(ev.target)) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
if (window.getSelection().toString() !== "") return;
|
2022-01-14 02:25:51 +01:00
|
|
|
|
|
|
|
if (defaultStore.state.useReactionPickerForContextMenu) {
|
2022-01-18 13:35:57 +01:00
|
|
|
ev.preventDefault();
|
2022-01-14 02:25:51 +01:00
|
|
|
react();
|
|
|
|
} else {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.contextMenu(
|
|
|
|
getNoteMenu({
|
|
|
|
note: note,
|
|
|
|
translating,
|
|
|
|
translation,
|
|
|
|
menuButton,
|
|
|
|
isDeleted,
|
|
|
|
currentClipPage,
|
|
|
|
}),
|
|
|
|
ev
|
|
|
|
).then(focus);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2022-01-14 02:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function menu(viaKeyboard = false): void {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.popupMenu(
|
|
|
|
getNoteMenu({
|
|
|
|
note: note,
|
|
|
|
translating,
|
|
|
|
translation,
|
|
|
|
menuButton,
|
|
|
|
isDeleted,
|
|
|
|
currentClipPage,
|
|
|
|
}),
|
|
|
|
menuButton.value,
|
|
|
|
{
|
|
|
|
viaKeyboard,
|
|
|
|
}
|
|
|
|
).then(focus);
|
2022-01-14 02:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function showRenoteMenu(viaKeyboard = false): void {
|
|
|
|
if (!isMyRenote) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
os.popupMenu(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: i18n.ts.unrenote,
|
|
|
|
icon: "ph-trash ph-bold ph-lg",
|
|
|
|
danger: true,
|
|
|
|
action: () => {
|
|
|
|
os.api("notes/delete", {
|
|
|
|
noteId: note.id,
|
|
|
|
});
|
|
|
|
isDeleted.value = true;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
renoteTime.value,
|
|
|
|
{
|
|
|
|
viaKeyboard: viaKeyboard,
|
|
|
|
}
|
|
|
|
);
|
2022-01-14 02:25:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function focus() {
|
|
|
|
el.value.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
function blur() {
|
|
|
|
el.value.blur();
|
|
|
|
}
|
|
|
|
|
|
|
|
function focusBefore() {
|
|
|
|
focusPrev(el.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
function focusAfter() {
|
|
|
|
focusNext(el.value);
|
|
|
|
}
|
|
|
|
|
2023-05-19 19:02:41 +02:00
|
|
|
function scrollIntoView() {
|
|
|
|
el.value.scrollIntoView();
|
|
|
|
}
|
|
|
|
|
2023-03-20 03:31:02 +01:00
|
|
|
function noteClick(e) {
|
2023-04-23 02:21:38 +02:00
|
|
|
if (document.getSelection().type === "Range" || props.detailedView) {
|
2023-03-20 03:31:02 +01:00
|
|
|
e.stopPropagation();
|
|
|
|
} else {
|
2023-04-08 02:01:42 +02:00
|
|
|
router.push(notePage(appearNote));
|
2023-03-20 03:31:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-14 02:25:51 +01:00
|
|
|
function readPromo() {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.api("promo/read", {
|
2022-06-05 05:26:36 +02:00
|
|
|
noteId: appearNote.id,
|
2022-01-14 02:25:51 +01:00
|
|
|
});
|
|
|
|
isDeleted.value = true;
|
|
|
|
}
|
2023-05-19 19:02:41 +02:00
|
|
|
|
2023-05-21 21:57:29 +02:00
|
|
|
const accessibleLabel = computed(() => {
|
|
|
|
let label = `${props.note.user.username}; `;
|
|
|
|
if (props.note.renote) {
|
2023-05-21 23:02:22 +02:00
|
|
|
label += `${i18n.t("renoted")} ${props.note.renote.user.username}; `;
|
2023-05-21 21:57:29 +02:00
|
|
|
if (props.note.renote.cw) {
|
|
|
|
label += `content warning: ${props.note.renote.cw}; `;
|
|
|
|
} else {
|
|
|
|
label += `${props.note.renote.text}; `;
|
|
|
|
}
|
2023-05-21 16:10:48 +02:00
|
|
|
} else {
|
2023-05-21 21:57:29 +02:00
|
|
|
if (props.note.cw) {
|
|
|
|
label += `content warning: ${props.note.cw}; `;
|
|
|
|
} else {
|
|
|
|
label += `${props.note.text}; `;
|
|
|
|
}
|
2023-05-21 16:10:48 +02:00
|
|
|
}
|
2023-05-21 21:57:29 +02:00
|
|
|
const date = new Date(props.note.createdAt);
|
2023-05-21 23:02:22 +02:00
|
|
|
label += `${date.toLocaleTimeString()}`;
|
2023-05-21 16:10:48 +02:00
|
|
|
return label;
|
2023-05-21 21:57:29 +02:00
|
|
|
})
|
|
|
|
|
2023-05-19 19:02:41 +02:00
|
|
|
defineExpose({
|
|
|
|
focus,
|
|
|
|
blur,
|
|
|
|
scrollIntoView,
|
|
|
|
});
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-02-15 09:17:19 +01:00
|
|
|
.tkcbzcuz {
|
2020-01-29 20:37:25 +01:00
|
|
|
position: relative;
|
|
|
|
transition: box-shadow 0.1s ease;
|
2021-11-28 12:07:37 +01:00
|
|
|
font-size: 1.05em;
|
2022-07-13 14:41:06 +02:00
|
|
|
overflow: clip;
|
2020-10-17 13:12:00 +02:00
|
|
|
contain: content;
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2020-12-26 14:56:01 +01:00
|
|
|
// これらの指定はパフォーマンス向上には有効だが、ノートの高さは一定でないため、
|
|
|
|
// 下の方までスクロールすると上のノートの高さがここで決め打ちされたものに変化し、表示しているノートの位置が変わってしまう
|
|
|
|
// ノートがマウントされたときに自身の高さを取得し contain-intrinsic-size を設定しなおせばほぼ解決できそうだが、
|
|
|
|
// 今度はその処理自体がパフォーマンス低下の原因にならないか懸念される。また、被リアクションでも高さは変化するため、やはり多少のズレは生じる
|
|
|
|
// 一度レンダリングされた要素はブラウザがよしなにサイズを覚えておいてくれるような実装になるまで待った方が良さそう(なるのか?)
|
|
|
|
//content-visibility: auto;
|
2023-04-08 02:01:42 +02:00
|
|
|
//contain-intrinsic-size: 0 128px;
|
2020-12-26 14:56:01 +01:00
|
|
|
|
2021-10-02 19:46:58 +02:00
|
|
|
&:focus-visible {
|
2020-01-29 20:37:25 +01:00
|
|
|
outline: none;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: "";
|
|
|
|
pointer-events: none;
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
z-index: 10;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
margin: auto;
|
|
|
|
width: calc(100% - 8px);
|
|
|
|
height: calc(100% - 8px);
|
2022-07-27 19:07:52 +02:00
|
|
|
border: solid 1px var(--focus);
|
2020-10-17 13:12:00 +02:00
|
|
|
border-radius: var(--radius);
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
2023-02-25 06:39:43 +01:00
|
|
|
& > .article > .main {
|
2023-04-08 02:01:42 +02:00
|
|
|
&:hover,
|
|
|
|
&:focus-within {
|
2023-02-25 06:39:43 +01:00
|
|
|
:deep(.footer .button) {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
2020-03-20 11:19:28 +01:00
|
|
|
> .reply-to {
|
2023-01-07 00:58:52 +01:00
|
|
|
& + .note-context {
|
|
|
|
.line::before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
2023-01-28 22:10:45 +01:00
|
|
|
margin-bottom: -10px;
|
2023-03-16 00:18:26 +01:00
|
|
|
margin-top: 16px;
|
2023-05-02 20:50:22 +02:00
|
|
|
border-left: 2px solid var(--X13);
|
2023-03-16 00:18:26 +01:00
|
|
|
margin-left: calc((var(--avatarSize) / 2) - 1px);
|
2023-01-07 00:58:52 +01:00
|
|
|
}
|
|
|
|
}
|
2020-03-20 11:19:28 +01:00
|
|
|
}
|
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
.note-context {
|
|
|
|
padding: 0 32px 0 32px;
|
2020-01-29 20:37:25 +01:00
|
|
|
display: flex;
|
2023-01-07 00:58:52 +01:00
|
|
|
&:first-child {
|
2023-01-08 08:30:42 +01:00
|
|
|
margin-top: 20px;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2023-01-07 00:58:52 +01:00
|
|
|
> :not(.line) {
|
|
|
|
width: 0;
|
|
|
|
flex-grow: 1;
|
|
|
|
position: relative;
|
2023-01-07 07:43:52 +01:00
|
|
|
line-height: 28px;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2023-01-07 00:58:52 +01:00
|
|
|
> .line {
|
2023-01-07 21:53:51 +01:00
|
|
|
width: var(--avatarSize);
|
2023-01-07 00:58:52 +01:00
|
|
|
display: flex;
|
|
|
|
margin-right: 14px;
|
|
|
|
margin-top: 0;
|
|
|
|
flex-grow: 0;
|
|
|
|
}
|
2023-04-08 02:01:42 +02:00
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
> div > i {
|
2023-04-08 02:01:42 +02:00
|
|
|
margin-left: -0.5px;
|
2023-01-07 00:58:52 +01:00
|
|
|
}
|
|
|
|
> .info {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 90%;
|
|
|
|
white-space: pre;
|
|
|
|
color: #f6c177;
|
|
|
|
|
|
|
|
> i {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
> .hide {
|
|
|
|
margin-left: auto;
|
|
|
|
color: inherit;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
> .renote {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
white-space: pre;
|
|
|
|
color: var(--renote);
|
2023-04-02 23:39:25 +02:00
|
|
|
cursor: pointer;
|
2023-01-07 00:58:52 +01:00
|
|
|
|
|
|
|
> i {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
2020-05-15 13:39:11 +02:00
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
> span {
|
|
|
|
overflow: hidden;
|
|
|
|
flex-shrink: 1;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
2023-04-08 02:01:42 +02:00
|
|
|
|
2023-01-07 00:58:52 +01:00
|
|
|
> .name {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .info {
|
|
|
|
margin-left: auto;
|
|
|
|
font-size: 0.9em;
|
2023-01-07 07:43:52 +01:00
|
|
|
display: flex;
|
2023-01-07 00:58:52 +01:00
|
|
|
|
|
|
|
> .time {
|
|
|
|
flex-shrink: 0;
|
|
|
|
color: inherit;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
> .dropdownIcon {
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
2020-05-15 13:39:11 +02:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .article {
|
2023-03-26 05:33:44 +02:00
|
|
|
padding: 4px 32px 10px;
|
2022-11-24 22:55:23 +01:00
|
|
|
cursor: pointer;
|
2022-11-27 06:37:23 +01:00
|
|
|
|
2022-12-02 07:39:50 +01:00
|
|
|
@media (pointer: coarse) {
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2023-01-05 17:08:23 +01:00
|
|
|
.header-container {
|
|
|
|
display: flex;
|
|
|
|
> .avatar {
|
|
|
|
flex-shrink: 0;
|
|
|
|
display: block;
|
2023-01-07 00:58:52 +01:00
|
|
|
margin: 0 14px 0 0;
|
2023-01-07 21:53:51 +01:00
|
|
|
width: var(--avatarSize);
|
|
|
|
height: var(--avatarSize);
|
2023-01-05 17:08:23 +01:00
|
|
|
position: relative;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
> .header {
|
|
|
|
width: 0;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
2023-01-03 19:16:02 +01:00
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
> .body {
|
2023-04-08 02:01:42 +02:00
|
|
|
margin-top: 0.7em;
|
2023-05-02 20:52:05 +02:00
|
|
|
> .translation {
|
|
|
|
border: solid 0.5px var(--divider);
|
|
|
|
border-radius: var(--radius);
|
|
|
|
padding: 12px;
|
|
|
|
margin-top: 8px;
|
2023-04-23 02:21:38 +02: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);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-23 02:21:38 +02:00
|
|
|
> .info {
|
2023-05-19 19:02:41 +02:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
flex-wrap: wrap;
|
2023-05-20 00:41:59 +02:00
|
|
|
gap: 0.7em;
|
2023-05-19 19:02:41 +02:00
|
|
|
margin-top: 16px;
|
2023-04-23 02:21:38 +02:00
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
> .footer {
|
2023-03-20 21:26:05 +01:00
|
|
|
position: relative;
|
|
|
|
z-index: 2;
|
2023-01-10 01:55:40 +01:00
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2023-03-20 21:26:05 +01:00
|
|
|
pointer-events: none; // Allow clicking anything w/out pointer-events: all; to open post
|
2023-04-23 02:22:53 +02:00
|
|
|
margin-top: 0.4em;
|
2020-01-29 20:37:25 +01:00
|
|
|
> .button {
|
|
|
|
margin: 0;
|
|
|
|
padding: 8px;
|
|
|
|
opacity: 0.7;
|
2023-01-10 01:55:40 +01:00
|
|
|
flex-grow: 1;
|
|
|
|
max-width: 3.5em;
|
2023-02-03 01:25:42 +01:00
|
|
|
width: max-content;
|
2023-01-10 01:55:40 +01:00
|
|
|
min-width: max-content;
|
2023-03-20 21:26:05 +01:00
|
|
|
pointer-events: all;
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: opacity 0.2s;
|
2023-01-10 03:53:39 +01:00
|
|
|
&:first-of-type {
|
2023-04-08 02:01:42 +02:00
|
|
|
margin-left: -0.5em;
|
2023-01-10 03:53:39 +01:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
&:hover {
|
2020-02-14 17:18:48 +01:00
|
|
|
color: var(--fgHighlighted);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
> .count {
|
|
|
|
display: inline;
|
|
|
|
margin: 0 0 0 8px;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.reacted {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-21 04:32:40 +01:00
|
|
|
|
|
|
|
> .reply {
|
2021-04-10 05:40:50 +02:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-03-21 04:32:40 +01:00
|
|
|
}
|
2020-07-11 03:13:11 +02:00
|
|
|
|
|
|
|
&.max-width_500px {
|
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.max-width_450px {
|
2023-01-07 21:53:51 +01:00
|
|
|
--avatarSize: 46px;
|
2023-02-03 21:44:40 +01:00
|
|
|
padding-top: 6px;
|
2023-01-07 00:58:52 +01:00
|
|
|
> .note-context {
|
|
|
|
padding-inline: 16px;
|
2023-03-26 05:33:44 +02:00
|
|
|
margin-top: 8px;
|
2023-01-07 04:15:32 +01:00
|
|
|
> :not(.line) {
|
2023-03-26 05:33:44 +02:00
|
|
|
margin-top: 0px;
|
2023-02-03 21:44:40 +01:00
|
|
|
}
|
|
|
|
> .line {
|
|
|
|
margin-right: 10px;
|
2023-04-02 23:39:25 +02:00
|
|
|
&::before {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
2023-01-07 04:15:32 +01:00
|
|
|
}
|
2020-07-11 03:13:11 +02:00
|
|
|
}
|
|
|
|
> .article {
|
2023-03-26 05:33:44 +02:00
|
|
|
padding: 4px 16px 8px;
|
2023-01-07 00:58:52 +01:00
|
|
|
> .main > .header-container > .avatar {
|
|
|
|
margin-right: 10px;
|
2022-11-22 20:01:25 +01:00
|
|
|
// top: calc(14px + var(--stickyTop, 0px));
|
2020-07-11 03:13:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.max-width_300px {
|
2023-01-07 21:53:51 +01:00
|
|
|
--avatarSize: 40px;
|
2020-07-11 03:13:11 +02:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
|
|
|
|
.muted {
|
|
|
|
padding: 8px;
|
|
|
|
text-align: center;
|
|
|
|
opacity: 0.7;
|
2023-05-10 23:44:08 +02:00
|
|
|
width: 100%;
|
2023-05-14 01:29:05 +02:00
|
|
|
|
|
|
|
._blur_text {
|
|
|
|
pointer-events: auto;
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
</style>
|