Guest User

Untitled

a guest
Aug 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const decreaseBlockDepth = (block, editorState) => {
  2. const blockKey = block.getKey();
  3. const depth = block.getDepth();
  4. const newBlock = block.set('depth', depth - 1);
  5. const contentState = editorState.getCurrentContent();
  6. const blockMap = contentState.getBlockMap();
  7. const newBlockMap = blockMap.set(blockKey, newBlock);
  8. return EditorState.push(
  9. editorState,
  10. contentState.merge({ blockMap: newBlockMap }),
  11. 'adjust-depth'
  12. );
  13. }
Add Comment
Please, Sign In to add comment