contenido
Version:
Contenido is a library with a set of tools to help you create your own rich text editor on top of draft-js without thinking about how to handle things.
12 lines (8 loc) • 303 B
text/typescript
// Custom Types
import type { State } from '../../types';
const getBlockType = (state: State) => {
const selection = state.getSelection();
const currentContent = state.getCurrentContent();
return currentContent.getBlockForKey(selection.getStartKey()).getType();
};
export default getBlockType;