mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 00:32:47 +02:00
fix(v2): fix codeblock copy button not including blank lines (#2285)
This commit is contained in:
parent
8d804c662c
commit
7086c279e2
2 changed files with 8 additions and 0 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue