Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit b0a9076

Browse files
committed
fixing empty lines when there is no yaml
1 parent 03f3efb commit b0a9076

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/services/EditEngineService.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ class EditEngine {
8686
async function persistFrontmatter(deletedColumn?: string): Promise<void> {
8787
const frontmatterGroupRegex = contentHasFrontmatter ? /^---[\s\S]+?---/g : /(^[\s\S]*$)/g;
8888
const frontmatterFieldsText = parseFrontmatterFieldsToString(rowFields, ddbbConfig, deletedColumn);
89-
const noteObject = {
90-
action: 'replace',
91-
file: file,
92-
regexp: frontmatterGroupRegex,
93-
newValue: contentHasFrontmatter ? `${frontmatterFieldsText}` : `${frontmatterFieldsText}\n$1`,
94-
};
95-
await VaultManagerDB.editNoteContent(noteObject);
89+
if (frontmatterFieldsText) {
90+
const noteObject = {
91+
action: 'replace',
92+
file: file,
93+
regexp: frontmatterGroupRegex,
94+
newValue: contentHasFrontmatter ? `${frontmatterFieldsText}` : `${frontmatterFieldsText}\n$1`,
95+
};
96+
await VaultManagerDB.editNoteContent(noteObject);
97+
}
9698
}
9799

98100
/*******************************************************************************************

0 commit comments

Comments
 (0)