facebookarchive / draft-js

A React framework for building text editors.
https://draftjs.org/
MIT License
22.57k stars 2.63k forks source link

Split Up Decorator Text #547

Open r6203 opened 8 years ago

r6203 commented 8 years ago

Hi!

Is it possible to create a decorator component consisting of multiple elements where each element contains a substring of the original decorated text?

E.g. the string *Hello* gets matched and a decorator is created. Now I want to render the "*"characters in a different color.

I was able to render a component consisting of 3 spans with different styles and substrings of "props.decoratedText". The problem is that the selection is screwed up - because I'm not rendering "props.children" inside the decorator.

Is there a way to split up the decorator text?

z0d14c commented 5 years ago

Also running into a pretty strong need for this -- would be nice!