Open jpuri opened 8 years ago
Thanks for the GIF -- very helpful. :)
I don't recall whether this was intentional, but block depth is always reset when setting type: https://github.com/facebook/draft-js/blob/master/src/model/transaction/setBlockTypeForContentState.js#L35
I'd be open to a PR to change this, since it seems reasonable to preserve depth on list items.
I'm not sure how the OP created that GIF -- Draft doesn't create true nested lists. All nesting is an illusion accomplished purely via CSS:
And the corresponding DOM:
Perhaps this is a newer approach that was not in play when the OP posted?
This is reproducible in any editor that has the two list types, and that has a way to increase depth, https://draftjs.org/ shows the issue. There are two separate behaviours:
GIF for the first behavior:
Second behaviour, the depth reset bug:
Is there anybody teach me how to do this issue, thx very much
If I create a OL of 2 items and change depth of 2nd item to 2, like this:
If I change type of 2nd item to UL it looses it depth:
But now if I try to indent second item, it works
While indenting its checked that block above is list, but its not checked if its list of same type. Also, please find gif attached. I can create a PR for the fix.