diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-09-01 22:39:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-01 22:39:30 +0900 |
| commit | d2abe2cd81199776da73af98e73bc291d91a0a12 (patch) | |
| tree | cb7e75ecea365bf858804c64cd822ab18ae4fcf1 /src | |
| parent | Merge pull request #2572 from syuilo/refactor-reversi-game (diff) | |
| parent | Refactor mfm component (diff) | |
| download | sharkey-d2abe2cd81199776da73af98e73bc291d91a0a12.tar.gz sharkey-d2abe2cd81199776da73af98e73bc291d91a0a12.tar.bz2 sharkey-d2abe2cd81199776da73af98e73bc291d91a0a12.zip | |
Merge pull request #2573 from syuilo/refactor-mfm
Refactor mfm component
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/views/components/misskey-flavored-markdown.ts | 13 |
1 files changed, 2 insertions, 11 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 e97da4302c..44680751f7 100644 --- a/src/client/app/common/views/components/misskey-flavored-markdown.ts +++ b/src/client/app/common/views/components/misskey-flavored-markdown.ts @@ -205,17 +205,8 @@ export default Vue.component('misskey-flavored-markdown', { } })); - const _els = []; - els.forEach((el, i) => { - if (el.tag == 'br') { - if (!['div', 'pre'].includes(els[i - 1].tag)) { - _els.push(el); - } - } else { - _els.push(el); - } - }); - + // el.tag === 'br' のとき i !== 0 が保証されるため、短絡評価により els[i - 1] は配列外参照しない + const _els = els.filter((el, i) => !(el.tag === 'br' && ['div', 'pre'].includes(els[i - 1].tag))); return createElement('span', _els); } }); |