const assertInsertAtomicBlock = ( state = editorState, entity = ENTITY_KEY, character = CHARACTER, ) => { const newState = insertAtomicBlock(state, entity, character); assertAtomic(newState); return newState; };
const insertAtomicBlock = targetEditorState => { const entityKey = targetEditorState .getCurrentContent() .createEntity('TEST', 'IMMUTABLE', null) .getLastCreatedEntityKey(); const character = ' '; const movedSelection = EditorState.moveSelectionToEnd(targetEditorState); return AtomicBlockUtils.insertAtomicBlock( movedSelection, entityKey, character, ); };