From 73e5a9c3b57116a5a01d26016964ad3ba8fe0e66 Mon Sep 17 00:00:00 2001 From: Eric Biewener Date: Tue, 6 Mar 2018 15:07:43 -0800 Subject: [PATCH] Allow indentation beyond one level deeper than block above. Summary: **Summary** Solves https://github.com/facebook/draft-js/issues/270. Removes restriction on indenting beyond one level deeper than the block above. Also allows indenting the very first item in a list. And all I had to do was delete code! ![image](https://cloud.githubusercontent.com/assets/253298/19991316/8dfb376e-a1f1-11e6-8e93-b8b49c30010b.png) **Test Plan** 1. Try indenting the first item in a list. 2. Try indenting a list item more than one level deeper than the item above it. Closes https://github.com/facebook/draft-js/pull/762 Differential Revision: D7137964 fbshipit-source-id: 597732b363537e34a0f466c3188f334b3fa30a9e --- src/model/modifier/RichTextEditorUtil.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/model/modifier/RichTextEditorUtil.js b/src/model/modifier/RichTextEditorUtil.js index 34ed60fd5e..25d90e9e57 100644 --- a/src/model/modifier/RichTextEditorUtil.js +++ b/src/model/modifier/RichTextEditorUtil.js @@ -210,28 +210,11 @@ const RichTextEditorUtil = { event.preventDefault(); - // Only allow indenting one level beyond the block above, and only if - // the block above is a list item as well. - var blockAbove = content.getBlockBefore(key); - if (!blockAbove) { - return editorState; - } - - var typeAbove = blockAbove.getType(); - if ( - typeAbove !== 'unordered-list-item' && - typeAbove !== 'ordered-list-item' - ) { - return editorState; - } - var depth = block.getDepth(); if (!event.shiftKey && depth === maxDepth) { return editorState; } - maxDepth = Math.min(blockAbove.getDepth() + 1, maxDepth); - var withAdjustment = adjustBlockDepthForContentState( content, selection,