React-draft-wysiwyg: Copy paste wraps or cuts single line into multiple lines.

Created on 19 Jul 2018  路  4Comments  路  Source: jpuri/react-draft-wysiwyg

When copy pasting from a html source like webpage, email and word editors single line is cut down or split into multiple lines with a inclusion of br tag where copy pasting the same content from plain notepad, G edit it's working perfectly.

  • How this behaviour can be fixed ?
  • Is there a way to remove source format ?

copypasteeditor

Most helpful comment

There's an issue with handlePaste.js

A quick workaround is to pass a false-returning function to handlePastedText to override the default behavior:

<Editor ... handlePastedText={() => false}>

All 4 comments

draft

@phantom0424 This is because when rendered on UI each line is wrapped in a div and corresponding to div the editor maps it to paragraph tag and break tag for new line if the content is wrapped in span. I hope that's the reason but couldn't find myself a solution or workaround for this would be great if someone could help out !

Anyone have any work arounds for this?

There's an issue with handlePaste.js

A quick workaround is to pass a false-returning function to handlePastedText to override the default behavior:

<Editor ... handlePastedText={() => false}>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gyarasu picture gyarasu  路  4Comments

DiegoGallegos4 picture DiegoGallegos4  路  4Comments

sontek picture sontek  路  4Comments

Fireprufe15 picture Fireprufe15  路  4Comments

caro-li picture caro-li  路  4Comments