UNPKG

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.

16 lines (11 loc) 411 B
// Custom Types import type { State } from '../../types'; const hasBlockTypeOf = (state: State, blockType: string) => { const selection = state.getSelection(); const currentContent = state.getCurrentContent(); const currentBlockType = currentContent .getBlockForKey(selection.getStartKey()) .getType(); return currentBlockType === blockType ? true : false; }; export default hasBlockTypeOf;