medium-editor icon indicating copy to clipboard operation
medium-editor copied to clipboard

Pasting removes empty newlines

Open ArsenyYankovsky opened this issue 6 years ago • 1 comments

Description

Pasting text from the attached doc removes the empty lines.

medium-editor-paste-issue.docx

Reading other issues regarding the empty lines and the paste I found that for some people the fix was to replace <p><br></p> parts with the <p>&nbsp;</p>. I tried doing that with following paste options:

                paste: {
                  preCleanReplacements: [[new RegExp(/<p [^>]*><br><\/p>/g), '<p>&nbsp;</p>']],
                  cleanPastedHTML: true,
                },

But that didn't fix the issue for me as it seems that <p>&nbsp;</p> were removed further in a cleanup process. That also broke setting text from the backend into the editor for me, which could be something in my project.

Versions

  • medium-editor: 5.23.3
  • browser: Google Chrome 71.0.3578.98
  • OS: Windows 10

ArsenyYankovsky avatar Feb 07 '19 02:02 ArsenyYankovsky

Any possible solution for not skipping the empty lines?

manojchowdary27 avatar Jul 23 '20 12:07 manojchowdary27