similiquedicta
Version:
A Plugin Architecture on top of Draft.JS
15 lines (13 loc) • 403 B
text/typescript
import { EditorState } from 'draft-js';
import getBlockMapKeys from './getBlockMapKeys';
export default (
editorState: EditorState
): Immutable.Iterable<number, string> => {
const selectionState = editorState.getSelection();
const contentState = editorState.getCurrentContent();
return getBlockMapKeys(
contentState,
selectionState.getStartKey(),
selectionState.getEndKey()
);
};