mirror of
https://github.com/mattang687/obsidian-checkbox-sort.git
synced 2026-07-22 05:45:27 +00:00
fix: ensure newline before moving checkbox to end of block
This commit is contained in:
parent
cb3c0440fc
commit
c51f8af6ab
1 changed files with 8 additions and 0 deletions
8
main.ts
8
main.ts
|
|
@ -281,6 +281,14 @@ export default class ObsidianCheckboxSort extends Plugin {
|
|||
if (isPeerTickedForSorting) {
|
||||
tickedItemsData.push(itemData);
|
||||
} else {
|
||||
// If this is the last item, it doesn't have a newline, and the first moved checkbox also doesn't have a newline - add a newline to this line.
|
||||
if (
|
||||
i == blockEndLine &&
|
||||
tickedItemsData.length > 0 &&
|
||||
!tickedItemsData[0].text.startsWith("\n")
|
||||
) {
|
||||
itemData.text += "\n";
|
||||
}
|
||||
untickedItemsData.push(itemData);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue