Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
367ccb99
Commit
367ccb99
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
enhance(client): add new mfm function (position, fg, bg)
Resolve #9527
parent
4151087d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
packages/frontend/src/components/mfm.ts
+28
-10
28 additions, 10 deletions
packages/frontend/src/components/mfm.ts
packages/frontend/src/scripts/mfm-tags.ts
+1
-1
1 addition, 1 deletion
packages/frontend/src/scripts/mfm-tags.ts
with
30 additions
and
11 deletions
CHANGELOG.md
+
1
−
0
View file @
367ccb99
...
...
@@ -111,6 +111,7 @@ You should also include the user name that made the change.
-
Client: add heatmap of daily active users to about page @syuilo
-
Client: introduce fluent emoji @syuilo
-
Client: add new theme @syuilo
-
Client: add new mfm function (position, fg, bg) @syuilo
-
Client: show fireworks when visit user who today is birthday @syuilo
-
Client: show bot warning on screen when logged in as bot account @syuilo
-
Client: improve overall performance of client @syuilo
...
...
This diff is collapsed.
Click to expand it.
packages/frontend/src/components/mfm.ts
+
28
−
10
View file @
367ccb99
...
...
@@ -87,22 +87,22 @@ export default defineComponent({
let
style
;
switch
(
token
.
props
.
name
)
{
case
'
tada
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
1s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
1s
'
;
style
=
'
font-size: 150%;
'
+
(
this
.
$store
.
state
.
animatedMfm
?
`animation: tada
${
speed
}
linear infinite both;`
:
''
);
break
;
}
case
'
jelly
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
1s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
1s
'
;
style
=
(
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-rubberBand
${
speed
}
linear infinite both;`
:
''
);
break
;
}
case
'
twitch
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
0.5s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
0.5s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-twitch
${
speed
}
ease infinite;`
:
''
;
break
;
}
case
'
shake
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
0.5s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
0.5s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-shake
${
speed
}
ease infinite;`
:
''
;
break
;
}
...
...
@@ -115,17 +115,17 @@ export default defineComponent({
token
.
props
.
args
.
x
?
'
mfm-spinX
'
:
token
.
props
.
args
.
y
?
'
mfm-spinY
'
:
'
mfm-spin
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
1.5s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
1.5s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation:
${
anime
}
${
speed
}
linear infinite; animation-direction:
${
direction
}
;`
:
''
;
break
;
}
case
'
jump
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
0.75s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
0.75s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-jump
${
speed
}
linear infinite;`
:
''
;
break
;
}
case
'
bounce
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
0.75s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
0.75s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-bounce
${
speed
}
linear infinite; transform-origin: center bottom;`
:
''
;
break
;
}
...
...
@@ -170,7 +170,7 @@ export default defineComponent({
},
genEl
(
token
.
children
));
}
case
'
rainbow
'
:
{
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
||
'
1s
'
;
const
speed
=
validTime
(
token
.
props
.
args
.
speed
)
??
'
1s
'
;
style
=
this
.
$store
.
state
.
animatedMfm
?
`animation: mfm-rainbow
${
speed
}
linear infinite;`
:
''
;
break
;
}
...
...
@@ -181,16 +181,34 @@ export default defineComponent({
return
h
(
MkSparkle
,
{},
genEl
(
token
.
children
));
}
case
'
rotate
'
:
{
const
degrees
=
parseInt
(
token
.
props
.
args
.
deg
)
||
'
90
'
;
const
degrees
=
parseInt
(
token
.
props
.
args
.
deg
)
??
'
90
'
;
style
=
`transform: rotate(
${
degrees
}
deg); transform-origin: center center;`
;
break
;
}
case
'
position
'
:
{
const
x
=
parseInt
(
token
.
props
.
args
.
x
??
'
0
'
);
const
y
=
parseInt
(
token
.
props
.
args
.
y
??
'
0
'
);
style
=
`transform: translateX(
${
x
}
em) translateY(
${
y
}
em);`
;
break
;
}
case
'
fg
'
:
{
let
color
=
token
.
props
.
args
.
color
;
if
(
!
/^
[
0-9a-f
]{3,6}
$/i
.
test
(
color
))
color
=
'
f00
'
;
style
=
`color: #
${
color
}
;`
;
break
;
}
case
'
bg
'
:
{
let
color
=
token
.
props
.
args
.
color
;
if
(
!
/^
[
0-9a-f
]{3,6}
$/i
.
test
(
color
))
color
=
'
f00
'
;
style
=
`background-color: #
${
color
}
;`
;
break
;
}
}
if
(
style
==
null
)
{
return
h
(
'
span
'
,
{},
[
'
$[
'
,
token
.
props
.
name
,
'
'
,
...
genEl
(
token
.
children
),
'
]
'
]);
}
else
{
return
h
(
'
span
'
,
{
style
:
'
display: inline-block;
'
+
style
,
style
:
'
display: inline-block;
'
+
style
,
},
genEl
(
token
.
children
));
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/frontend/src/scripts/mfm-tags.ts
+
1
−
1
View file @
367ccb99
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
'
,
'
position
'
,
'
fg
'
,
'
bg
'
,
'
font
'
,
'
blur
'
,
'
rainbow
'
,
'
sparkle
'
,
'
rotate
'
];
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment