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

Commit e0c8c44

Browse files
committed
control metainfo of projects plugin
1 parent 9d20c59 commit e0c8c44

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/api/obsidian-projects-api.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DatabaseCore, DB_ICONS, DEFAULT_COLUMN_CONFIG, InputType, SourceDataTypes } from "helpers/Constants";
1+
import { DB_ICONS, DEFAULT_COLUMN_CONFIG, InputType, SourceDataTypes } from "helpers/Constants";
22
import DBFolderPlugin from "main";
33

44
import {
@@ -12,6 +12,7 @@ import { LocalSettings } from "cdm/SettingsModel";
1212
import { DatabaseColumn } from "cdm/DatabaseModel";
1313
import { dbTrim } from "helpers/StylesHelper";
1414

15+
const projectsMetadataColumns = ["File", "name", "path"];
1516
class ProjectAPI extends ProjectView {
1617
private plugin: DBFolderPlugin;
1718
private view: DatabaseView;
@@ -40,10 +41,11 @@ class ProjectAPI extends ProjectView {
4041
.values(this.view.diskConfig.yaml.columns)
4142
.filter((column) => !column.isMetadata).length;
4243
const actualFields = fields
43-
.filter((field) => ![DatabaseCore.FRONTMATTER_KEY, "File"].contains(field.name));
44+
.filter((field) => !projectsMetadataColumns.contains(field.name));
45+
4446
if (currentColumnsLength !== actualFields.length) {
4547
const newColumns: Record<string, DatabaseColumn> = {};
46-
fields.forEach((field, index) => {
48+
actualFields.forEach((field, index) => {
4749
const { name, type } = field;
4850
/**
4951
* I can not use the view object here without make it a class variable
@@ -71,6 +73,7 @@ class ProjectAPI extends ProjectView {
7173

7274
this.view.diskConfig.yaml.columns = newColumns;
7375
await this.view.diskConfig.saveOnDisk();
76+
await this.view.reloadDatabase();
7477
}
7578
}
7679

0 commit comments

Comments
 (0)