Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Allow indentation beyond one level deeper than block above.
Browse files Browse the repository at this point in the history
Summary:
**Summary**

Solves #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 #762

Differential Revision: D7137964

fbshipit-source-id: 597732b363537e34a0f466c3188f334b3fa30a9e
  • Loading branch information
ericbiewener authored and facebook-github-bot committed Mar 6, 2018
1 parent 8eea2c2 commit 73e5a9c
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/model/modifier/RichTextEditorUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 73e5a9c

Please sign in to comment.