Skip to content

Desktop,Mobile: Fixes #12744: Fix adding lists to blank lines using toolbar buttons #12745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Jul 18, 2025

Summary

Fixes #12744.

Testing

Automated tests

This pull requests adds the following automated tests:

  • In an empty document, with the toggleList command:
    • Verifies that toggleList(ListType.Checklist) adds - [ ] .
    • Verifies that toggleList(ListType.OrderedList) adds 1. .
    • Verifies that toggleList(ListType.UnorderedList) adds - .
  • In a document containing an empty block quote:
    • Verifies that toggleList(ListType.UnorderedList) adds - after the block quote markup.
  • In a document containing a header, followed by newlines (cursor on the last empty line):
    • Verifies that toggleList(ListType.UnorderedList) adds - to the empty line.

Manual testing

On Fedora Linux:

  1. Open the desktop app.
  2. Create a new note.
  3. Add an unordered list using the editor toolbar.
  4. Add four items to the list.
  5. Move the cursor somewhere near the middle of the list.
  6. Press the "numbered list" button in the editor toolbar.
  7. Verify that the item containing the cursor changes to a numbered list item.
  8. Undo.
  9. Convert the list to a non-tight list — add an empty newline after each list item.
  10. Select the list.
  11. Press the "numbered list" button.
  12. Verify that the list is converted to a numbered list, without adding new list items.

@@ -68,7 +68,7 @@ describe('markdownCommands.toggleList', () => {
const checklistEndText = ['- [ ] a', '- [ ] test'].join('\n');

const input = `${checklistStartText}\n\n${checklistEndText}`;
const expected = `${checklistStartText}\n\n${checklistEndText}`; // no change
const expected = `${checklistStartText}\n- [ ] \n${checklistEndText}`; // new item
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug fix changes the expected behavior for the should not toggle the full list when the cursor is on a blank line test.

  • Previously:
    Moving the cursor to an empty line in a non-tight list and pressing a list toggle button did nothing.
  • Now:
    The button adds a new list item with the relevant type.

@personalizedrefrigerator personalizedrefrigerator added mobile All mobile platforms desktop All desktop platforms markdown-editor About the Markdown editor labels Jul 18, 2025
@laurent22 laurent22 merged commit e62cba5 into laurent22:dev Jul 21, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop All desktop platforms markdown-editor About the Markdown editor mobile All mobile platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor: Toggling lists is broken (Regression/unreleased)
2 participants