Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The HardBreak extensions does not preserve line breaks in format text/plain #1842

Closed
damingo opened this issue Sep 5, 2021 · 4 comments
Closed
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@damingo
Copy link

damingo commented Sep 5, 2021

Steps to reproduce the bug

  1. Go to https://www.tiptap.dev/api/nodes/hard-break/#hardbreak and select & copy the text in the example editor.
  2. Inspect the content of the clipboard by pasting it here: https://evercoder.github.io/clipboard-inspector/
  3. The clipboard content for format text/plain is

Thisisasingleparagraphwithlinebreaks.

@damingo damingo added Type: Bug The issue or pullrequest is related to a bug v2 labels Sep 5, 2021
@philippkuehn
Copy link
Contributor

Hey, it’s the same behavior at https://prosemirror.net/ so it’s not a bug with tiptap itself.

What you can do for now is to define a custom renderText method for the HardBreak extension:

const CustomHardBreak = HardBreak.extend({
  renderText() {
    return '\n'
  },
})

@damingo
Copy link
Author

damingo commented Sep 6, 2021

That's an elegant solution. Thank you!

@philippkuehn
Copy link
Contributor

I decided to put that into the extension!

@jonjieviduya
Copy link

I decided to put that into the extension!

@philippkuehn How can we use it now in the extension? it says "Duplicate extension names found [hardBreak]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

3 participants