From 4c4b43124862a4ee564cb8d6dafa44be8c95cb78 Mon Sep 17 00:00:00 2001 From: Leah Date: Thu, 23 May 2024 18:08:31 +0000 Subject: [PATCH] Ported cutiekeys followmouse mfm --- locales/en-US.yml | 3 + .../frontend/src/components/CkFollowMouse.vue | 81 +++++++++++ .../frontend/src/components/MkMfmWindow.vue | 134 ++++++++++-------- .../global/MkMisskeyFlavoredMarkdown.ts | 23 +++ packages/frontend/src/const.ts | 5 +- 5 files changed, 184 insertions(+), 62 deletions(-) create mode 100644 packages/frontend/src/components/CkFollowMouse.vue diff --git a/locales/en-US.yml b/locales/en-US.yml index fe27a131ba..07173c131e 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2478,6 +2478,7 @@ _moderationLogTypes: unsetUserAvatar: "Unset this user's avatar" unsetUserBanner: "Unset this user's banner" _mfm: + uncommonFeature: "This is not a widespread feature, it may not display properly on most other fedi software, including other Misskey forks" intro: "MFM is a markup language used on Misskey, Sharkey, Firefish, Akkoma, and more that can be used in many places. Here you can view a list of all available MFM syntax." dummy: "Sharkey expands the world of the Fediverse" mention: "Mention" @@ -2542,6 +2543,8 @@ _mfm: rotateDescription: "Turns content by a specified angle." position: "Position" positionDescription: "Move content by a specified amount." + followMouse: "Follow Mouse" + followMouseDescription: "Content will follow the mouse. On mobile it will follow wherever the user taps." scale: "Scale" scaleDescription: "Scale content by a specified amount." foreground: "Foreground color" diff --git a/packages/frontend/src/components/CkFollowMouse.vue b/packages/frontend/src/components/CkFollowMouse.vue new file mode 100644 index 0000000000..b55a577b3f --- /dev/null +++ b/packages/frontend/src/components/CkFollowMouse.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/packages/frontend/src/components/MkMfmWindow.vue b/packages/frontend/src/components/MkMfmWindow.vue index ce2a0e7391..fd23eb0097 100644 --- a/packages/frontend/src/components/MkMfmWindow.vue +++ b/packages/frontend/src/components/MkMfmWindow.vue @@ -9,17 +9,17 @@ - +
{{ i18n.ts._mfm.intro }}
-
+
{{ i18n.ts._mfm.mention }}

{{ i18n.ts._mfm.mentionDescription }}

- +
@@ -29,7 +29,7 @@

{{ i18n.ts._mfm.hashtagDescription }}

- +
@@ -39,7 +39,7 @@

{{ i18n.ts._mfm.linkDescription }}

- +
@@ -49,7 +49,7 @@

{{ i18n.ts._mfm.emojiDescription }}

- +
@@ -59,7 +59,7 @@

{{ i18n.ts._mfm.boldDescription }}

- +
@@ -69,7 +69,7 @@

{{ i18n.ts._mfm.smallDescription }}

- +
@@ -79,7 +79,7 @@

{{ i18n.ts._mfm.quoteDescription }}

- +
@@ -89,7 +89,7 @@

{{ i18n.ts._mfm.centerDescription }}

- +
@@ -99,7 +99,7 @@

{{ i18n.ts._mfm.inlineCodeDescription }}

- +
@@ -109,7 +109,7 @@

{{ i18n.ts._mfm.blockCodeDescription }}

- +
@@ -119,7 +119,7 @@

{{ i18n.ts._mfm.inlineMathDescription }}

- +
@@ -129,7 +129,7 @@

{{ i18n.ts._mfm.blockMathDescription }}

- +
@@ -139,7 +139,7 @@

{{ i18n.ts._mfm.searchDescription }}

- +
@@ -149,7 +149,7 @@

{{ i18n.ts._mfm.flipDescription }}

- +
@@ -159,7 +159,7 @@

{{ i18n.ts._mfm.fontDescription }}

- +
@@ -169,7 +169,7 @@

{{ i18n.ts._mfm.x2Description }}

- +
@@ -179,7 +179,7 @@

{{ i18n.ts._mfm.x3Description }}

- +
@@ -189,7 +189,7 @@

{{ i18n.ts._mfm.x4Description }}

- +
@@ -199,7 +199,7 @@

{{ i18n.ts._mfm.blurDescription }}

- +
@@ -209,7 +209,7 @@

{{ i18n.ts._mfm.jellyDescription }}

- +
@@ -219,7 +219,7 @@

{{ i18n.ts._mfm.tadaDescription }}

- +
@@ -229,7 +229,7 @@

{{ i18n.ts._mfm.jumpDescription }}

- +
@@ -239,7 +239,7 @@

{{ i18n.ts._mfm.bounceDescription }}

- +
@@ -249,7 +249,7 @@

{{ i18n.ts._mfm.spinDescription }}

- +
@@ -259,7 +259,7 @@

{{ i18n.ts._mfm.shakeDescription }}

- +
@@ -269,7 +269,7 @@

{{ i18n.ts._mfm.twitchDescription }}

- +
@@ -279,7 +279,7 @@

{{ i18n.ts._mfm.rainbowDescription }}

- +
@@ -289,7 +289,7 @@

{{ i18n.ts._mfm.sparkleDescription }}

- + MFM
@@ -299,7 +299,7 @@

{{ i18n.ts._mfm.rotateDescription }}

- + MFM
@@ -309,17 +309,29 @@

{{ i18n.ts._mfm.positionDescription }}

- + MFM
+
+
{{ i18n.ts._mfm.followMouse }}
+ {{ i18n.ts._mfm.uncommonFeature }} +
+
+

{{ i18n.ts._mfm.followMouseDescription }}

+
+ + MFM +
+
+
{{ i18n.ts._mfm.scale }}

{{ i18n.ts._mfm.scaleDescription }}

- + MFM
@@ -329,7 +341,7 @@

{{ i18n.ts._mfm.foregroundDescription }}

- + MFM
@@ -339,7 +351,7 @@

{{ i18n.ts._mfm.backgroundDescription }}

- + MFM
@@ -349,7 +361,7 @@

{{ i18n.ts._mfm.plainDescription }}

- + MFM
@@ -362,18 +374,19 @@ diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index f8b5fcfedc..2f699ccd84 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -6,6 +6,7 @@ import { VNode, h, defineAsyncComponent, SetupContext } from 'vue'; import * as mfm from '@transfem-org/sfm-js'; import * as Misskey from 'misskey-js'; +import CkFollowMouse from '../CkFollowMouse.vue'; import MkUrl from '@/components/global/MkUrl.vue'; import MkTime from '@/components/global/MkTime.vue'; import MkLink from '@/components/MkLink.vue'; @@ -232,6 +233,28 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext = { tada: ['speed=', 'delay='], jelly: ['speed=', 'delay='], @@ -179,11 +179,12 @@ export const MFM_PARAMS: Record = { position: ['x=', 'y='], fg: ['color='], bg: ['color='], - border: ['width=', 'style=', 'color=', 'radius=', 'noclip'], + border: ['width=', 'style=', 'color=', 'radius=', 'noclip'], font: ['serif', 'monospace', 'cursive', 'fantasy', 'emoji', 'math'], blur: [], rainbow: ['speed=', 'delay='], rotate: ['deg='], ruby: [], unixtime: [], + followmouse: ['x', 'y', 'rotateByVelocity', 'speed='], };