mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 09:33:09 +02:00
ひとつの投稿内で使えるそれぞれの動きのあるMFM構文は3回までに制限
This commit is contained in:
parent
5bbc95d659
commit
6ef28214df
1 changed files with 10 additions and 3 deletions
|
@ -41,6 +41,9 @@ export default Vue.component('misskey-flavored-markdown', {
|
||||||
ast = this.ast;
|
ast = this.ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bigCount = 0;
|
||||||
|
let motionCount = 0;
|
||||||
|
|
||||||
// Parse ast to DOM
|
// Parse ast to DOM
|
||||||
const els = flatten(ast.map(token => {
|
const els = flatten(ast.map(token => {
|
||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
|
@ -62,12 +65,14 @@ export default Vue.component('misskey-flavored-markdown', {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'big': {
|
case 'big': {
|
||||||
|
bigCount++;
|
||||||
const isLong = length(token.big) > 10;
|
const isLong = length(token.big) > 10;
|
||||||
|
const isMany = bigCount > 3;
|
||||||
return (createElement as any)('strong', {
|
return (createElement as any)('strong', {
|
||||||
attrs: {
|
attrs: {
|
||||||
style: 'display: inline-block; font-size: 200%;'
|
style: `display: inline-block; font-size: ${ isMany ? '100%' : '200%' };`
|
||||||
},
|
},
|
||||||
directives: [this.$store.state.settings.disableAnimatedMfm || isLong ? {} : {
|
directives: [this.$store.state.settings.disableAnimatedMfm || isLong || isMany ? {} : {
|
||||||
name: 'animate-css',
|
name: 'animate-css',
|
||||||
value: { classes: 'tada', iteration: 'infinite' }
|
value: { classes: 'tada', iteration: 'infinite' }
|
||||||
}]
|
}]
|
||||||
|
@ -75,12 +80,14 @@ export default Vue.component('misskey-flavored-markdown', {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'motion': {
|
case 'motion': {
|
||||||
|
motionCount++;
|
||||||
const isLong = length(token.motion) > 10;
|
const isLong = length(token.motion) > 10;
|
||||||
|
const isMany = motionCount > 3;
|
||||||
return (createElement as any)('span', {
|
return (createElement as any)('span', {
|
||||||
attrs: {
|
attrs: {
|
||||||
style: 'display: inline-block;'
|
style: 'display: inline-block;'
|
||||||
},
|
},
|
||||||
directives: [this.$store.state.settings.disableAnimatedMfm || isLong ? {} : {
|
directives: [this.$store.state.settings.disableAnimatedMfm || isLong || isMany ? {} : {
|
||||||
name: 'animate-css',
|
name: 'animate-css',
|
||||||
value: { classes: 'rubberBand', iteration: 'infinite' }
|
value: { classes: 'rubberBand', iteration: 'infinite' }
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue