This commit is contained in:
syuilo 2024-08-27 19:47:25 +09:00
parent 55b62e3246
commit e41ba1d177
6 changed files with 61 additions and 23 deletions

View File

@ -0,0 +1,24 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<span>
<span>@{{ user.username }}</span>
<span v-if="user.host || detail" style="opacity: 0.5;">@{{ user.host || host }}</span>
</span>
</template>
<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { toUnicode } from 'punycode/';
import { host as hostRaw } from '@/config.js';
defineProps<{
user: Misskey.entities.UserLite;
detail?: boolean;
}>();
const host = toUnicode(hostRaw);
</script>

View File

@ -5,7 +5,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<MkA v-user-preview="canonical" :class="[$style.root]" :to="url" :style="{ background: bgCss }"> <MkA v-user-preview="canonical" :class="[$style.root]" :to="url" :style="{ background: bgCss }">
<img :class="$style.icon" :src="avatarUrl" alt="">
<span> <span>
<span>@{{ username }}</span> <span>@{{ username }}</span>
<span v-if="(host != localHost)" :class="$style.host">@{{ toUnicode(host) }}</span> <span v-if="(host != localHost)" :class="$style.host">@{{ toUnicode(host) }}</span>
@ -31,8 +30,6 @@ const url = `/${canonical}`;
const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--mention')); const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue('--mention'));
bg.setAlpha(0.1); bg.setAlpha(0.1);
const bgCss = bg.toRgbString(); const bgCss = bg.toRgbString();
const avatarUrl = `/avatar/@${props.username}@${props.host}`;
</script> </script>
<style lang="scss" module> <style lang="scss" module>
@ -43,15 +40,6 @@ const avatarUrl = `/avatar/@${props.username}@${props.host}`;
color: var(--mention); color: var(--mention);
} }
.icon {
width: 1.5em;
height: 1.5em;
object-fit: cover;
margin: 0 0.2em 0 0;
vertical-align: bottom;
border-radius: 100%;
}
.host { .host {
opacity: 0.5; opacity: 0.5;
} }

View File

@ -136,6 +136,8 @@ import EmPoll from '@/components/EmPoll.vue';
import EmA from '@/components/EmA.vue'; import EmA from '@/components/EmA.vue';
import EmAvatar from '@/components/EmAvatar.vue'; import EmAvatar from '@/components/EmAvatar.vue';
import EmTime from '@/components/EmTime.vue'; import EmTime from '@/components/EmTime.vue';
import EmUserName from '@/components/EmUserName.vue';
import EmAcct from '@/components/EmAcct.vue';
import { userPage } from '@/utils.js'; import { userPage } from '@/utils.js';
import { notePage } from '@/utils.js'; import { notePage } from '@/utils.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';

View File

@ -0,0 +1,21 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<EmMfm :text="user.name ?? user.username" :author="user" :plain="true" :nowrap="nowrap" :emojiUrls="user.emojis"/>
</template>
<script lang="ts" setup>
import { } from 'vue';
import * as Misskey from 'misskey-js';
import EmMfm from './EmMfm.js';
const props = withDefaults(defineProps<{
user: Misskey.entities.User;
nowrap?: boolean;
}>(), {
nowrap: true,
});
</script>

View File

@ -108,6 +108,13 @@ rt {
text-align: center; text-align: center;
} }
._nowrap {
white-space: pre !important;
word-wrap: normal !important; // https://codeday.me/jp/qa/20190424/690106.html
overflow: hidden;
text-overflow: ellipsis;
}
._button { ._button {
user-select: none; user-select: none;
-webkit-user-select: none; -webkit-user-select: none;

View File

@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
> >
<MkLoading v-if="iframeLoading" :class="$style.embedCodeGenPreviewSpinner"/> <MkLoading v-if="iframeLoading" :class="$style.embedCodeGenPreviewSpinner"/>
<div :class="$style.embedCodeGenPreviewWrapper"> <div :class="$style.embedCodeGenPreviewWrapper">
<div :class="$style.embedCodeGenPreviewTitle">{{ i18n.ts.preview }}</div> <div class="_acrylic" :class="$style.embedCodeGenPreviewTitle">{{ i18n.ts.preview }}</div>
<div ref="resizerRootEl" :class="$style.embedCodeGenPreviewResizerRoot" inert> <div ref="resizerRootEl" :class="$style.embedCodeGenPreviewResizerRoot" inert>
<div <div
:class="$style.embedCodeGenPreviewResizer" :class="$style.embedCodeGenPreviewResizer"
@ -326,16 +326,12 @@ onUnmounted(() => {
} }
.embedCodeGenPreviewTitle { .embedCodeGenPreviewTitle {
width: fit-content; position: absolute;
flex-shrink: 0; z-index: 100;
padding: 0 8px; top: 8px;
background-color: var(--panel); left: 8px;
border-right: 1px solid var(--divider); padding: 6px 8px;
border-bottom: 1px solid var(--divider); border-radius: 6px;
border-bottom-right-radius: var(--radius);
height: 28px;
line-height: 28px;
box-sizing: border-box;
} }
.embedCodeGenPreviewSpinner { .embedCodeGenPreviewSpinner {