fix(v2): fix codeblock copy button not including blank lines (#2285)

This commit is contained in:
KohheePeace 2020-02-16 21:21:46 +07:00 committed by GitHub
parent 8d804c662c
commit 7086c279e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -102,6 +102,10 @@ export default ({children, className: languageClassName, metastring}) => {
<code ref={target} className={styles.codeBlockLines} style={style}>
{tokens.map((line, i) => {
if (line.length === 1 && line[0].content === '') {
line[0].content = '\n'; // eslint-disable-line no-param-reassign
}
const lineProps = getLineProps({line, key: i});
if (highlightLines.includes(i + 1)) {