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

Commit effd737

Browse files
committed
filter reserved columns
1 parent 9f75b6c commit effd737

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/modals/newColumn/handlers/AddExistingColumnHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AddColumnModalHandlerResponse } from "cdm/ModalsModel";
22
import { obtainColumnsFromRows } from "components/Columns";
3-
import { DynamicInputType, MetadataColumns } from "helpers/Constants";
3+
import { DatabaseCore, DynamicInputType, MetadataColumns } from "helpers/Constants";
44
import { t } from "lang/helpers";
55
import { Notice, Setting } from "obsidian";
66
import { AbstractHandlerClass } from "patterns/chain/AbstractHandler";
@@ -32,11 +32,15 @@ export class AddExistingColumnHandler extends AbstractHandlerClass<AddColumnModa
3232
}
3333

3434
promiseOfObtainColumnsFromRows.then((columnsRaw: string[]) => {
35-
// Filter out the columns that are already in the table
3635
const currentColumns = (columnState.info.getValueOfAllColumnsAsociatedWith('id') as string[]).map(id => id.toLowerCase());
3736
const filteredColumns: Record<string, string> = {};
3837
columnsRaw
3938
.sort((a, b) => a.localeCompare(b))
39+
// Filter reserved columns
40+
.filter((columnName: string) => {
41+
return DatabaseCore.FRONTMATTER_KEY !== columnName;
42+
})
43+
// Filter out the columns that are already in the table
4044
.filter((columnName: string) => {
4145
return !currentColumns.includes(columnName.toLowerCase())
4246
}).forEach((columnName: string) => {

0 commit comments

Comments
 (0)