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

Commit ee4f524

Browse files
committed
now edit label check if exist in frontmatter. Then edit key. if not nothing happens
1 parent a111ec2 commit ee4f524

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/helpers/VaultManagement.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,15 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: str
129129
// Modify key of a column
130130
async function columnKey(): Promise<void> {
131131
if (column.isInline) {
132+
// Go to inline mode
132133
await inlineColumnKey();
133134
return;
134135
}
135-
if (!Object.prototype.hasOwnProperty.call(rowFields.frontmatter, columnId)) {
136+
// If field does not exist yet, ignore it
137+
if (!Object.prototype.hasOwnProperty.call(currentFrontmatter, columnId)) {
136138
return;
137139
}
140+
138141
// Check if the column is already in the frontmatter
139142
// assign an empty value to the new key
140143
rowFields.frontmatter[newValue] = rowFields.frontmatter[columnId] ?? "";

src/services/FileManagerService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class VaultManager {
6565

6666
ontainCurrentFrontmatter(content: string): Record<string, string> {
6767
const match = content.match(/^---\s+([\w\W]+?)\s+---/);
68+
console.log("probando");
6869
if (match) {
6970
const frontmatterRaw = match[1];
7071
const yaml = parseYaml(frontmatterRaw);
@@ -74,8 +75,8 @@ class VaultManager {
7475
.forEach(key => {
7576
// add frontmatter fields that are not specified as database fields
7677
frontmatter[key] = yaml[key];
77-
return frontmatter;
7878
});
79+
return frontmatter;
7980
}
8081
else {
8182
return undefined;

0 commit comments

Comments
 (0)