* enhance(frontend): ノートプレビューにCWが反映されるように * Update CHANGELOG.md * refactor: 不要な条件を除去 * Revert "refactor: 不要な条件を除去" This reverts commit e4eff689bd1f2df78411a2f01ee05434e2d298a8. * fix: やっぱり不要な条件だった
104 lines
2 KiB
Vue
104 lines
2 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div :class="$style.root">
|
|
<MkAvatar :class="$style.avatar" :user="user" link preview/>
|
|
<div :class="$style.main">
|
|
<div :class="$style.header">
|
|
<MkUserName :user="user" :nowrap="true"/>
|
|
</div>
|
|
<div>
|
|
<p v-if="useCw" :class="$style.cw">
|
|
<Mfm v-if="cw != ''" :text="cw" :author="user" :nyaize="'respect'" :i="user" style="margin-right: 8px;"/>
|
|
<MkCwButton v-model="showContent" :text="text.trim()" :files="files" :poll="poll" style="margin: 4px 0;"/>
|
|
</p>
|
|
<div v-show="!useCw || showContent">
|
|
<Mfm :text="text.trim()" :author="user" :nyaize="'respect'" :i="user"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
import * as Misskey from 'misskey-js';
|
|
import MkCwButton from '@/components/MkCwButton.vue';
|
|
|
|
const showContent = ref(false);
|
|
|
|
const props = defineProps<{
|
|
text: string;
|
|
files: Misskey.entities.DriveFile[];
|
|
poll?: {
|
|
choices: string[];
|
|
multiple: boolean;
|
|
expiresAt: string | null;
|
|
expiredAfter: string | null;
|
|
};
|
|
useCw: boolean;
|
|
cw: string | null;
|
|
user: Misskey.entities.User;
|
|
}>();
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
display: flex;
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: clip;
|
|
font-size: 0.95em;
|
|
}
|
|
|
|
.avatar {
|
|
flex-shrink: 0 !important;
|
|
display: block !important;
|
|
margin: 0 10px 0 0 !important;
|
|
width: 40px !important;
|
|
height: 40px !important;
|
|
border-radius: 8px !important;
|
|
pointer-events: none !important;
|
|
}
|
|
|
|
.main {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.cw {
|
|
cursor: default;
|
|
display: block;
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow-wrap: break-word;
|
|
}
|
|
|
|
.header {
|
|
margin-bottom: 2px;
|
|
font-weight: bold;
|
|
width: 100%;
|
|
overflow: clip;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
@container (min-width: 350px) {
|
|
.avatar {
|
|
margin: 0 10px 0 0 !important;
|
|
width: 44px !important;
|
|
height: 44px !important;
|
|
}
|
|
}
|
|
|
|
@container (min-width: 500px) {
|
|
.avatar {
|
|
margin: 0 12px 0 0 !important;
|
|
width: 48px !important;
|
|
height: 48px !important;
|
|
}
|
|
}
|
|
</style>
|