[SuperEditor] Allow continuing list item sequence by typing (Resolves #1894) #2061
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[SuperEditor] Allow continuing list item sequence by typing. Resolves #1894
Current behavior
Type:
Press enter. This will result in the following:
Delete
2.
and type2.
again.The editor doesn't convert
2.
to a list item.Other apps
Most apps do convert the
2.
to a list item, allowing the user to continue the sequence. Some of them allow numbers out of sequence, like:And some of them allows starting a list with a number different from
1
.Changes in this PR
This PR adds the ability to continue the list, by typing the next number in the sequence. For example, given the list
Typing
3.
will convert the paragraph to a list item, but typing any other number will not.Limitations
We cannot allow starting lists with numbers different from one without major changes. The list item ordinal value is only computed and stored at the view model level. To allow starting a list with arbitrary numbers we would need to store the ordinal value directly on the node.