Currently we have a demand for this feature
We have successfully, implemented step1, but have no idea on how to implement step2
For step1, our code is like this
const currentContent = editorState.getCurrentContent()
const entity = currentContent.createEntity('image', 'IMMUTABLE', {
src: base64,
id: id,
})
const newState = EditorState.set(editorState, {
currentContent: entity,
})
const lastKey = entity.getLastCreatedEntityKey()
setEditorState(AtomicBlockUtils.insertAtomicBlock(newState, lastKey, ' '))
For Step2, we tried the api like this.
Modifier.replaceWithFragment
But Could not figured it out
Does anyone knows the solution?