From a16e921ffcb4d1ecd84d41caa33692bf2c00bc20 Mon Sep 17 00:00:00 2001 From: Puniko Date: Sun, 21 May 2023 16:52:11 +0200 Subject: [PATCH] add position token Co-authored-by: syuilo --- packages/client/src/components/mfm.ts | 6 ++++++ packages/client/src/scripts/mfm-tags.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index 64fe5bdb5..58e8571f4 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -185,6 +185,12 @@ export default defineComponent({ style = `transform: rotate(${degrees}deg); transform-origin: center center;`; break; } + case 'position': { + const x = parseFloat(token.props.args.x ?? '0'); + const y = parseFloat(token.props.args.y ?? '0'); + style = `transform: translateX(${x}em) translateY(${y}em);`; + break; + } } if (style == null) { return h('span', {}, ['$[', token.props.name, ' ', ...genEl(token.children), ']']); diff --git a/packages/client/src/scripts/mfm-tags.ts b/packages/client/src/scripts/mfm-tags.ts index 18e8d7038..7f721361e 100644 --- a/packages/client/src/scripts/mfm-tags.ts +++ b/packages/client/src/scripts/mfm-tags.ts @@ -1 +1 @@ -export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'sparkle', 'rotate']; +export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'position'];