merge: upstream

This commit is contained in:
Marie 2024-01-15 12:07:35 +01:00
commit 4c1f6be735
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
132 changed files with 12167 additions and 792 deletions

View file

@ -24,9 +24,11 @@ import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js'
import { defaultStore } from '@/store.js';
import { customEmojisMap } from '@/custom-emojis.js';
import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import * as sound from '@/scripts/sound.js';
import { i18n } from '@/i18n.js';
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
const props = defineProps<{
name: string;
@ -93,7 +95,19 @@ function onClick(ev: MouseEvent) {
react(`:${props.name}:`);
sound.playMisskeySfx('reaction');
},
}] : [])], ev.currentTarget ?? ev.target);
}] : []), {
text: i18n.ts.info,
icon: 'ti ti-info-circle',
action: async () => {
os.popup(MkCustomEmojiDetailedDialog, {
emoji: await misskeyApiGet('emoji', {
name: customEmojiName.value,
}),
}, {
anchor: ev.target,
});
},
}], ev.currentTarget ?? ev.target);
}
}
</script>

View file

@ -48,10 +48,6 @@ type MfmEvents = {
clickEv(id: string): void;
};
type MfmEvents = {
clickEv(id: string): void;
};
// eslint-disable-next-line import/no-default-export
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
const isNote = props.isNote ?? true;
@ -69,6 +65,11 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
const useAnim = defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : props.isAnim ? true : false;
const validColor = (c: string | null | undefined): string | null => {
if (c == null) return null;
return c.match(/^[0-9a-f]{3,6}$/i) ? c : null;
};
const MkFormula = defineAsyncComponent(() => import('@/components/MkFormula.vue'));
/**
@ -247,17 +248,30 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
break;
}
case 'fg': {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color)) color = 'f00';
let color = validColor(token.props.args.color);
color = color ?? 'f00';
style = `color: #${color}; overflow-wrap: anywhere;`;
break;
}
case 'bg': {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color)) color = 'f00';
let color = validColor(token.props.args.color);
color = color ?? 'f00';
style = `background-color: #${color}; overflow-wrap: anywhere;`;
break;
}
case 'border': {
let color = validColor(token.props.args.color);
color = color ? `#${color}` : 'var(--accent)';
let b_style = token.props.args.style;
if (
!['hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']
.includes(b_style)
) b_style = 'solid';
const width = parseFloat(token.props.args.width ?? '1');
const radius = parseFloat(token.props.args.radius ?? '0');
style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px`;
break;
}
case 'ruby': {
if (token.children.length === 1) {
const child = token.children[0];