Skip to content

Copying code block content doesn't preserve newlines on Firefox #5663

@Martinsos

Description

@Martinsos

🐛 Bug Report

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io
  • I have read the console error message carefully (if applicable)

Description

Open https://docusaurus.io/docs/markdown-features/code-blocks in Firefox, select piece of code from code block, press Ctrl+C to copy it, paste it anywhere (e.g. in text editor), and notice how newlines are lost.

On Chrome this problem doesn't exist and newlines are correctly preserved/captured.

If "copy" button (in the top-right corner) is used, newlines are preserved though, even on Firefox. But "copy" button requires copying the whole block of code, you can't copy just part of it.

I tried doing the same thing at https://mdxjs.com/, and there copying works ok, newlines are preserved on Firefox.

Have you read the Contributing Guidelines on issues?

Yes

Your environment

ArchLinux 5.14.7-arch1-1, Firefox 93.0 (64-bit).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionhelp wantedAsking for outside help and/or contributions to this particular issue or PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions