mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 12:47:14 +02:00
fix: preserve line breaks when copy code in Firefox (#5668)
This commit is contained in:
parent
7868df13f1
commit
99f6e665e8
2 changed files with 3 additions and 4 deletions
|
@ -223,8 +223,8 @@ export default function CodeBlock({
|
||||||
style={style}>
|
style={style}>
|
||||||
<code className={styles.codeBlockLines}>
|
<code className={styles.codeBlockLines}>
|
||||||
{tokens.map((line, i) => {
|
{tokens.map((line, i) => {
|
||||||
if (line.length === 1 && line[0].content === '') {
|
if (line.length === 1 && line[0].content === '\n') {
|
||||||
line[0].content = '\n';
|
line[0].content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const lineProps = getLineProps({line, key: i});
|
const lineProps = getLineProps({line, key: i});
|
||||||
|
@ -238,6 +238,7 @@ export default function CodeBlock({
|
||||||
{line.map((token, key) => (
|
{line.map((token, key) => (
|
||||||
<span key={key} {...getTokenProps({token, key})} />
|
<span key={key} {...getTokenProps({token, key})} />
|
||||||
))}
|
))}
|
||||||
|
<br />
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -56,8 +56,6 @@
|
||||||
float: left;
|
float: left;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
padding: var(--ifm-pre-padding);
|
padding: var(--ifm-pre-padding);
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
|
|
Loading…
Add table
Reference in a new issue