mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 01:44:10 +02:00
Merge branch 'develop' into room
This commit is contained in:
@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template>
|
||||
<MkWindow
|
||||
ref="window"
|
||||
:initialWidth="800"
|
||||
:initialHeight="500"
|
||||
:canResize="true"
|
||||
@closed="emit('closed')"
|
||||
>
|
||||
|
||||
@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template>
|
||||
<MkWindow
|
||||
ref="windowEl"
|
||||
:initialWidth="500"
|
||||
:initialHeight="500"
|
||||
:canResize="true"
|
||||
:closeButton="true"
|
||||
:buttonsLeft="buttonsLeft"
|
||||
|
||||
@@ -106,7 +106,9 @@ async function toggleReaction() {
|
||||
reaction: props.reaction,
|
||||
}).then(() => {
|
||||
const emoji = customEmojisMap.get(emojiName.value);
|
||||
if (emoji == null) return;
|
||||
if (emoji == null && getUnicodeEmojiOrNull(props.reaction) == null) {
|
||||
return;
|
||||
}
|
||||
noteEvents.emit(`reacted:${props.noteId}`, {
|
||||
userId: me.id,
|
||||
reaction: props.reaction,
|
||||
@@ -138,7 +140,9 @@ async function toggleReaction() {
|
||||
reaction: props.reaction,
|
||||
}).then(() => {
|
||||
const emoji = customEmojisMap.get(emojiName.value);
|
||||
if (emoji == null) return;
|
||||
if (emoji == null && getUnicodeEmojiOrNull(props.reaction) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
noteEvents.emit(`reacted:${props.noteId}`, {
|
||||
userId: me.id,
|
||||
|
||||
@@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
@afterLeave="emit('closed')"
|
||||
>
|
||||
<div v-if="showing" ref="rootEl" :class="[$style.root, { [$style.maximized]: maximized }]">
|
||||
<div :class="$style.body" class="_shadow" @mousedown="onBodyMousedown" @keydown="onKeydown">
|
||||
<div :class="$style.body" class="_shadow" @pointerdown="onBodyPointerDown" @keydown="onKeydown">
|
||||
<div :class="[$style.header, { [$style.mini]: mini }]" @contextmenu.prevent.stop="onContextmenu">
|
||||
<span :class="$style.headerLeft">
|
||||
<template v-if="!minimized">
|
||||
@@ -106,8 +106,8 @@ function capturePointer(evt: PointerEvent) {
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
initialWidth: number;
|
||||
initialHeight: number | null;
|
||||
initialWidth?: number | null;
|
||||
initialHeight?: number | null;
|
||||
canResize?: boolean;
|
||||
closeButton?: boolean;
|
||||
mini?: boolean;
|
||||
@@ -116,7 +116,7 @@ const props = withDefaults(defineProps<{
|
||||
buttonsLeft?: WindowButton[];
|
||||
buttonsRight?: WindowButton[];
|
||||
}>(), {
|
||||
initialWidth: 400,
|
||||
initialWidth: null,
|
||||
initialHeight: null,
|
||||
canResize: false,
|
||||
closeButton: true,
|
||||
@@ -131,6 +131,12 @@ const emit = defineEmits<{
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const INITIAL_WINDOW_WIDTH_RATIO = 0.5;
|
||||
const INITIAL_WINDOW_HEIGHT_RATIO = 0.75;
|
||||
const INITIAL_WINDOW_WIDTH_MIN = 400; // スクリーンの最小幅に合わせるのはapplyTransormWidthの担当
|
||||
const INITIAL_WINDOW_WIDTH_MAX = 1000; // 画面幅いっぱいに広がるのを防止するための最大幅
|
||||
const INITIAL_WINDOW_HEIGHT_MIN = 500; // スクリーンの最小幅に合わせるのはapplyTransormHeightの担当
|
||||
|
||||
provide('inWindow', true);
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
@@ -216,7 +222,7 @@ function unMinimize() {
|
||||
if (position.left + windowWidth > browserWidth) main.style.left = browserWidth - windowWidth + 'px';
|
||||
}
|
||||
|
||||
function onBodyMousedown() {
|
||||
function onBodyPointerDown() {
|
||||
top();
|
||||
}
|
||||
|
||||
@@ -484,8 +490,14 @@ function onBrowserResize() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
applyTransformWidth(props.initialWidth);
|
||||
if (props.initialHeight) applyTransformHeight(props.initialHeight);
|
||||
let initialWidth = props.initialWidth;
|
||||
let initialHeight = props.initialHeight;
|
||||
|
||||
if (initialWidth == null) initialWidth = Math.min(Math.max(Math.round(window.innerWidth * INITIAL_WINDOW_WIDTH_RATIO), INITIAL_WINDOW_WIDTH_MIN), INITIAL_WINDOW_WIDTH_MAX);
|
||||
if (initialHeight == null) initialHeight = Math.max(Math.round(window.innerHeight * INITIAL_WINDOW_HEIGHT_RATIO), INITIAL_WINDOW_HEIGHT_MIN);
|
||||
|
||||
applyTransformWidth(initialWidth);
|
||||
applyTransformHeight(initialHeight);
|
||||
|
||||
if (rootEl.value) {
|
||||
applyTransformTop((window.innerHeight / 2) - (rootEl.value.offsetHeight / 2));
|
||||
|
||||
@@ -150,6 +150,7 @@ import { definePage } from '@/page.js';
|
||||
import { claimAchievement, claimedAchievements } from '@/utility/achievements.js';
|
||||
import { $i } from '@/i.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { DEFAULT_EMOJIS } from '@@/js/const.js';
|
||||
|
||||
const patronsWithIcon = [{
|
||||
name: 'カイヤン',
|
||||
@@ -429,7 +430,12 @@ const containerEl = useTemplateRef('containerEl');
|
||||
|
||||
function iconLoaded() {
|
||||
if (containerEl.value == null) return;
|
||||
const emojis = prefer.s.emojiPalettes[0].emojis;
|
||||
const emojis = prefer.s.emojiPalettes[0]?.emojis ?? [];
|
||||
|
||||
if (emojis.length < DEFAULT_EMOJIS.length) {
|
||||
emojis.push(...DEFAULT_EMOJIS.slice(0, DEFAULT_EMOJIS.length - emojis.length));
|
||||
}
|
||||
|
||||
const containerWidth = containerEl.value.offsetWidth;
|
||||
for (let i = 0; i < 32; i++) {
|
||||
easterEggEmojis.value.push({
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { hemisphere } from '@@/js/intl-const.js';
|
||||
import { DEFAULT_EMOJIS } from '@@/js/const.js';
|
||||
import { prefersReducedMotion } from '@@/js/config.js';
|
||||
import { definePreferences } from './manager.js';
|
||||
import type { Theme } from '@/theme.js';
|
||||
@@ -103,7 +104,7 @@ export const PREF_DEF = definePreferences({
|
||||
default: () => [{
|
||||
id: genId(),
|
||||
name: '',
|
||||
emojis: ['👍', '❤️', '😆', '🤔', '😮', '🎉', '💢', '😥', '😇', '🍮'],
|
||||
emojis: DEFAULT_EMOJIS,
|
||||
}] as {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user