jpuri / draftjs-utils

An collection of useful utility functions for DraftJS.
MIT License
286 stars 47 forks source link

getSelectionText should take a parameter to replace line breaks with a given char #22

Open fibonacid opened 4 years ago

fibonacid commented 4 years ago

Sometimes you need to include line feeds in you selected text, so I it would be nice to do this:

 const text = getSelectionText(editorState, "\n");
 console.log(text);

And the result would be

> Dear Foo\nHow are you ?