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

Allow linebreaks instead of paragraphs for copy-pasted code #1582

Open
iwasherefirst2 opened this issue Sep 3, 2021 · 2 comments
Open

Allow linebreaks instead of paragraphs for copy-pasted code #1582

iwasherefirst2 opened this issue Sep 3, 2021 · 2 comments

Comments

@iwasherefirst2
Copy link

Description

I am using medium-editor for my developing blog. I want to add code by copy-paste and then use prism.js to display it.
Currently when I copy & paste code, each line is a new paragraph. This does not work with prism.js. I would need real linebreaks.

How can I change that if I copy multiple lines that they are not in multiple paragraphs, but just separated by \n? Is this configurable?

Steps to reproduce

  1. Copy multiple lines in editor

Expected behavior:
Lines should be seperated by new line

Actual behavior:
Lines are seperated by paragraph

Versions

  • medium-editor: 5.23.3
  • browser: Firefox 91.0.2
  • OS: Ubuntu 18.04
@iwasherefirst2
Copy link
Author

iwasherefirst2 commented Sep 4, 2021

I found out that I can use the paste options to prevent HTML tags, but I still get <br> with line breaks. I tried these settings:

paste: {
                forcePlainText: true,
                cleanPastedHTML: true,
                cleanReplacements: [
                    [new RegExp(/<br>/gi), "\n"],
                ]
            },

This is almost what I am looking for, but "
" seems not to be replaced by a newline, but instead by just nothing?

@julienGrd
Copy link

yeah same behavior here #1600

anyway this project is dead and full of bug, i will begin to search for another library for editing HTML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants