summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-08-05 19:36:19 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-08-05 19:36:19 +0900
commit6ef28214df4899043077dc3d7efa4cf1bfaf9a72 (patch)
tree7eb8f31c774826e970d9ff29f30366ea5e39bb3b /src
parent文字数が多い場合は動きを無効に (diff)
downloadmisskey-6ef28214df4899043077dc3d7efa4cf1bfaf9a72.tar.gz
misskey-6ef28214df4899043077dc3d7efa4cf1bfaf9a72.tar.bz2
misskey-6ef28214df4899043077dc3d7efa4cf1bfaf9a72.zip
ひとつの投稿内で使えるそれぞれの動きのあるMFM構文は3回までに制限
Diffstat (limited to 'src')
-rw-r--r--src/client/app/common/views/components/misskey-flavored-markdown.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/app/common/views/components/misskey-flavored-markdown.ts b/src/client/app/common/views/components/misskey-flavored-markdown.ts
index 69e727d6f3..2a349c6e5f 100644
--- a/src/client/app/common/views/components/misskey-flavored-markdown.ts
+++ b/src/client/app/common/views/components/misskey-flavored-markdown.ts
@@ -41,6 +41,9 @@ export default Vue.component('misskey-flavored-markdown', {
ast = this.ast;
}
+ let bigCount = 0;
+ let motionCount = 0;
+
// Parse ast to DOM
const els = flatten(ast.map(token => {
switch (token.type) {
@@ -62,12 +65,14 @@ export default Vue.component('misskey-flavored-markdown', {
}
case 'big': {
+ bigCount++;
const isLong = length(token.big) > 10;
+ const isMany = bigCount > 3;
return (createElement as any)('strong', {
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',
value: { classes: 'tada', iteration: 'infinite' }
}]
@@ -75,12 +80,14 @@ export default Vue.component('misskey-flavored-markdown', {
}
case 'motion': {
+ motionCount++;
const isLong = length(token.motion) > 10;
+ const isMany = motionCount > 3;
return (createElement as any)('span', {
attrs: {
style: 'display: inline-block;'
},
- directives: [this.$store.state.settings.disableAnimatedMfm || isLong ? {} : {
+ directives: [this.$store.state.settings.disableAnimatedMfm || isLong || isMany ? {} : {
name: 'animate-css',
value: { classes: 'rubberBand', iteration: 'infinite' }
}]