summernote / summernote

Super simple WYSIWYG editor
https://summernote.org
MIT License
11.41k stars 2.24k forks source link

Paste adds empty lines at the begining and the end #4620

Open inigochoa opened 2 months ago

inigochoa commented 2 months ago

Checklist

Steps to reproduce

Im pasting text from a word document. Text gets correctly split into paragraphs. However, at the end it adds a <div><br></div> making a new line. It sometimes adds that code to the begining.

I also checked that the pasted text does not end in a blank line.

FireShot Capture

Expected behavior

Pasted text should end in a paragraph.

Current behavior

Pasted text ends with a blank new line (<div><br></div>).

Minimal example reproducing the issue

No response

Environment

No summernote extensions are used

1der1 commented 2 months ago

MS Office content is not HTML 5. If you use it in HTML 5 context, you must convert it. Additionally, there is a lot of bloat, which can be tidied up without losing functionality.

We made a post about it: https://1der1.com/blogs/news/ms-office-to-html-in-perfection

I highly recommend: https://github.com/DiemenDesign/summernote-cleaner

inigochoa commented 2 months ago

Thank you for the response.

We tried with summernote-cleaner but got no luck. We will leave it for now, but thanks

DennisSuitters commented 2 months ago

If it was a while ago when you tried, just note, that there's been recent updates by another contributor. I suggest trying it again, I hope it does what you need.