Draft.js: Can I modify an existing entity without applying it as new one?

2.4k views Asked by At

I'm trying to use Draft.js for a rich text editor, where the requirement is to be able to edit a link's url. In all examples I've seen, you can apply an entity to a selection range, but the entity already exists. I'd just like to change its value.

If it is impossible to change the url without re-applying, is there a good way to get the entity re-applied to the same range it is currently applied to?

Any help would be appreciated.

1

There are 1 answers

0
Jiang YD On BEST ANSWER

Modifier.applyEntity() does what you need. https://draftjs.org/docs/api-reference-modifier#applyentity