Do you want to request a feature or report a bug?
question
Is there a way to remove all entities at once from the contentState and not only a specific one?
I'm implementing a grammar check and I want to wipe out all entities ever time I receive a new batch of grammar mistakes from the backend.
Same question for me.
There isn't (at least that I know of).
You need to use something like ContentBlock.findEntityRanges() to iterate through all of the entity ranges, and remove them.
The simplest method I found was to use the "low-level" APIs to map through all blocks, and through all characters in each block, replacing chars that have a defined entity with CharacterMetadata.applyEntity(char, null). See for example this filterEntityRanges function.
@thibaudcolas thanks that helps!
Most helpful comment
There isn't (at least that I know of).
You need to use something like
ContentBlock.findEntityRanges()to iterate through all of the entity ranges, and remove them.The simplest method I found was to use the "low-level" APIs to map through all blocks, and through all characters in each block, replacing chars that have a defined entity with
CharacterMetadata.applyEntity(char, null). See for example this filterEntityRanges function.