mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +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}>
|
||||
<code className={styles.codeBlockLines}>
|
||||
{tokens.map((line, i) => {
|
||||
if (line.length === 1 && line[0].content === '') {
|
||||
line[0].content = '\n';
|
||||
if (line.length === 1 && line[0].content === '\n') {
|
||||
line[0].content = '';
|
||||
}
|
||||
|
||||
const lineProps = getLineProps({line, key: i});
|
||||
|
@ -238,6 +238,7 @@ export default function CodeBlock({
|
|||
{line.map((token, key) => (
|
||||
<span key={key} {...getTokenProps({token, key})} />
|
||||
))}
|
||||
<br />
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
float: left;
|
||||
min-width: 100%;
|
||||
padding: var(--ifm-pre-padding);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
|
Loading…
Add table
Reference in a new issue