Draft-js: `splitTextIntoTextBlocks` should adhere to Unicode standard

Created on 11 Aug 2017  路  1Comment  路  Source: facebook/draft-js

When pasting text with line-separators (U+2028), it鈥檚 not split.

Example (copy from here):

aap鈥╪oot鈥╩ies

Expected when pasting

aap
noot
mies

Unicode line breaking algorithm: http://www.unicode.org/reports/tr14/tr14-32.html#Algorithm

Suggested fix:
Change NEWLINE_REGEX to

var NEWLINE_REGEX = /\r\n?|\n|\u000C|\u000B|\u0085|\u2028|\u2029/g;

Demo: https://jsfiddle.net/wpsper15/

bug

Most helpful comment

Thanks for reporting this! Seems reasonable to me, I'd like to look at our uses and see if there is any reason it was not done in the first place. I'm guessing it was just an oversight though.

>All comments

Thanks for reporting this! Seems reasonable to me, I'd like to look at our uses and see if there is any reason it was not done in the first place. I'm guessing it was just an oversight though.

Was this page helpful?
0 / 5 - 0 ratings