yabwe / medium-editor

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.
https://yabwe.github.io/medium-editor/
Other
16.03k stars 1.85k forks source link

paste with cleanPastedHTML=true dont keep line break #1600

Open julienGrd opened 1 year ago

julienGrd commented 1 year ago

Description

Hello guys, i try to paste some html in an editor and i notice my br tag are not kept

this is the configuration :

paste: {
                forcePlainText: false,
                cleanPastedHTML: true,
                cleanReplacements: [],
                cleanAttrs: ['class', 'style', 'dir'],
                cleanTags: ['meta'],
                unwrapTags: ['div', 'li', 'ul', 'code', 'em']
            },

and the HTML i try to paste

<p>TITRE 1</p><p><u>coucou</u></p><p>plus couc</p><br><p>TITRE 2</p><p><b>test</b></p><br><p>TITRE 3</p>

result of the paste in the editor

<p>TITRE 1</p><p><u>coucou</u></p><p>plus couc</p><p>TITRE 2</p><p><b>test</b></p><p>TITRE 3</p>

Its reproductible on the demo https://yabwe.github.io/medium-editor/demo.html

If I put cleanPastedHTML to false, the br are kept

Versions

thanks !