diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-12-09 01:00:03 +0900 |
|---|---|---|
| committer | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-12-09 01:05:55 +0900 |
| commit | 1de8e1eeb1c741be49f49cab5292943b2623e222 (patch) | |
| tree | afd8209f82e1cac22c22c2aee7ae60df5de56277 /src/client | |
| parent | Fix follow duplicate (#3548) (diff) | |
| download | misskey-1de8e1eeb1c741be49f49cab5292943b2623e222.tar.gz misskey-1de8e1eeb1c741be49f49cab5292943b2623e222.tar.bz2 misskey-1de8e1eeb1c741be49f49cab5292943b2623e222.zip | |
#2501
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/app/common/views/components/mfm.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/client/app/common/views/components/mfm.ts b/src/client/app/common/views/components/mfm.ts index 8d7d360521..7b0f8bd170 100644 --- a/src/client/app/common/views/components/mfm.ts +++ b/src/client/app/common/views/components/mfm.ts @@ -3,7 +3,7 @@ import { length } from 'stringz'; import { Node } from '../../../../../mfm/parser'; import parse from '../../../../../mfm/parse'; import MkUrl from './url.vue'; -import { concat } from '../../../../../prelude/array'; +import { concat, sum } from '../../../../../prelude/array'; import MkFormula from './formula.vue'; import MkGoogle from './google.vue'; import { toUnicode } from 'punycode'; @@ -12,9 +12,7 @@ import syntaxHighlight from '../../../../../mfm/syntax-highlight'; function getTextCount(tokens: Node[]): number { let count = 0; const extract = (tokens: Node[]) => { - tokens.filter(x => x.name === 'text').forEach(x => { - count += length(x.props.text); - }); + count += sum(tokens.filter(x => x.name === 'text').map(x => length(x.props.text))); tokens.filter(x => x.children).forEach(x => { extract(x.children); }); |