import { ContentBlock, EditorState } from 'draft-js'; const getCurrentBlock = (editorState: EditorState): ContentBlock => { const selectionState = editorState.getSelection(); const contentState = editorState.getCurrentContent(); return contentState.getBlockForKey(selectionState.getStartKey()); }; export default getCurrentBlock;