Repository navigation
feat: sort checklist items A→Z from the note menu - #163
Merged
Merged
Conversation
Adds a "Sort A→Z" action to the note editor's More (dot) menu for checklists. It writes a new manual order once, so drag and drop keeps working afterwards. - Nested items stay with their parent; children are sorted among siblings. - With "Move completed checklist items to bottom" on, unchecked and checked items are sorted as separate groups; with it off, all items sort together. - Locale-aware, case-insensitive and numeric comparison (Intl.Collator), so accented letters and "Item 2" / "Item 10" sort as expected. - Undo/redo work like other checklist edits. Fixes ericerkz#143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #143
Summary
Adds a Sort A→Z action to the note editor's More (⋮) menu for checklist notes, as suggested in the issue. It reorders the items once by writing a new manual order, so drag and drop still works afterwards.
Intl.Collator, using the UI locale; case-insensitive and numeric), so "Éclair" sorts with E and "Item 2" comes before "Item 10". Empty rows go last.Changes
src/app/utils/checklist-sort.ts: a new pure helper,sortChecklistItems().src/app/utils/checklist-sort.test.ts: tests for the helper, plus a newtest:checklist-sortnpm script.input.component.ts/.html: adds thesortCboxItems()action and the menu entry.translations/en.jsonandtranslations/context.json: add the newinput.sort_a_to_zstring.How tested
npm run test:checklist-sort: 4/4 pass (case/accents/numbers, nesting, completed groups, empty rows and stable ties).npm run test:i18n(16/16) andnpm run translations:checkpass.ng buildsucceeds.checkBoxesorder is correct.I have read
CONTRIBUTING.mdand agree that my contribution is submitted under the Kept Contributor License Agreement.Screenshots