fix: ensure newline before moving checkbox to end of block

This commit is contained in:
kiber.io 2025-06-24 20:41:21 +04:00 committed by GitHub
parent cb3c0440fc
commit c51f8af6ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}