editor-js / list

Advanced List tool for the Editor.js.
MIT License
48 stars 47 forks source link

Split list on enter in empty item #30

Closed alexanderjulmer closed 1 week ago

alexanderjulmer commented 3 years ago

Expected behaviour: Hitting Enter in an empty list item of level 1 (no indentation) removes the item, splits the list and inserts a paragraph.

1. First item
2. Second item
3. | <-- Cursor, hit Enter here
4. Fourth item
5. Fifth item
1. First item
2. Second item

| <-- Cursor now in new paragraph

4. Fourth item
5. Fifth item

Actual behaviour: Hitting Enter in an empty list item adds another empty list item below and moves the cursor to the new empty list item.

Reasoning: Splitting the list is standard behavior of Google Docs and Microsoft Word.

Note: The behavior in Google Docs is slightly different: Google Docs actually adds a non-indented paragraph in the list item so that the list stays intact.

If implemented, the reverse should also be implemented: Deleting a paragraph block between two lists should merge the lists.