mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 16:23:09 +02:00
Merge pull request #2573 from syuilo/refactor-mfm
Refactor mfm component
This commit is contained in:
commit
d2abe2cd81
1 changed files with 2 additions and 11 deletions
|
@ -205,17 +205,8 @@ export default Vue.component('misskey-flavored-markdown', {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const _els = [];
|
// el.tag === 'br' のとき i !== 0 が保証されるため、短絡評価により els[i - 1] は配列外参照しない
|
||||||
els.forEach((el, i) => {
|
const _els = els.filter((el, i) => !(el.tag === 'br' && ['div', 'pre'].includes(els[i - 1].tag)));
|
||||||
if (el.tag == 'br') {
|
|
||||||
if (!['div', 'pre'].includes(els[i - 1].tag)) {
|
|
||||||
_els.push(el);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_els.push(el);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return createElement('span', _els);
|
return createElement('span', _els);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue