Skip to content

Commit ee3da51

Browse files
committed
TaskSorting 1.2.2
1 parent afc2b43 commit ee3da51

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

dwertheimer.TaskSorting/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
See Plugin [README](https://github.com/NotePlan/plugins/blob/main/dwertheimer.TaskSorting/README.md) for details on available commands and use case.
66

7+
## [1.2.2] - 2025-08-29 (@dwertheimer)
8+
9+
- Remove NotePlan popup nag on repeat deletion check using Editor.skipNextRepeatDeletionCheck
10+
711
## [1.2.1] - 2025-08-29 (@dwertheimer)
812

913
- Added noteOverride parameter to sortTasksUnderHeading command for @jgclark

dwertheimer.TaskSorting/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"noteplan.minAppVersion": "3.4.0",
44
"plugin.id": "dwertheimer.TaskSorting",
55
"plugin.name": "🥷 Task Sorting & Tools",
6-
"plugin.version": "1.2.1",
7-
"plugin.lastUpdateInfo": "1.2.1: Added noteOverride parameter to sortTasksUnderHeading command.",
6+
"plugin.version": "1.2.2",
7+
"plugin.lastUpdateInfo": "1.2.2: Remove NotePlan popup nag on repeat deletion check",
88
"plugin.description": "Commands for sorting tasks in a note",
99
"plugin.author": "dwertheimer",
1010
"plugin.requiredFiles-EDIT_ME": [

dwertheimer.TaskSorting/src/sortTasks.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ async function getUserSort(sortChoices: Array<any> = SORT_ORDERS) {
362362
function deleteExistingTasks(note: CoreNoteFields, tasks: ParagraphsGroupedByType) {
363363
const tasksToDelete = []
364364
for (const typ of TASK_TYPES) {
365-
if (tasks[typ].length) logDebug(`\tQueuing ${tasks[typ].length} ${typ} tasks for deletion from note`)
365+
if (tasks[typ].length) logDebug(`\tQueuing ${tasks[typ].length} ${typ} tasks for temporary deletion from note (so they can be re-inserted in the correct order)`)
366366
// if (shouldBackupTasks) {
367367
// await saveBackup(tasks[typ])
368368
// }
@@ -396,7 +396,16 @@ function deleteExistingTasks(note: CoreNoteFields, tasks: ParagraphsGroupedByTyp
396396
const tasksToDeleteByIndex = sortListBy(tasksToDelete, ['lineIndex']) //NP API may give wrong results if lineIndexes are not in ASC order
397397
logDebug(`\tsortTasks/deleteExistingTasks`, `After Sort Lines in Note:${note.paragraphs.length} | Lines to delete:${tasksToDelete.length}`)
398398
// clo(tasksToDelete, `\tsortTasks/deleteExistingTasks=`)
399-
note.removeParagraphs(tasksToDeleteByIndex)
399+
// We are going to delete them one at a time, and so that the page does not get confused, we will delete them bottom to top
400+
const tasksToDeleteByIndexReverse = sortListBy(tasksToDelete, ['-lineIndex']) //NP API may give wrong results if lineIndexes are not in ASC order
401+
tasksToDeleteByIndexReverse.forEach((t) => {
402+
// $FlowIgnore
403+
if (note.note) {
404+
// we are in the editor
405+
Editor.skipNextRepeatDeletionCheck = true
406+
}
407+
note.removeParagraph(t)
408+
})
400409
logDebug(
401410
`\tsortTasks/deleteExistingTasks`,
402411
`After Remove Paragraphs, Lines in note:${note.paragraphs.length} ${

0 commit comments

Comments
 (0)