Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const decreaseBlockDepth = (block, editorState) => {
- const blockKey = block.getKey();
- const depth = block.getDepth();
- const newBlock = block.set('depth', depth - 1);
- const contentState = editorState.getCurrentContent();
- const blockMap = contentState.getBlockMap();
- const newBlockMap = blockMap.set(blockKey, newBlock);
- return EditorState.push(
- editorState,
- contentState.merge({ blockMap: newBlockMap }),
- 'adjust-depth'
- );
- }
Add Comment
Please, Sign In to add comment