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

Commit 3c63792

Browse files
committed
icons & templates filters extension
1 parent cb16610 commit 3c63792

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/DatabaseView.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export class DatabaseView extends TextFileView implements HoverParent {
9696
this.plugin.addView(this, data);
9797
}
9898

99+
getIcon() {
100+
return DB_ICONS.NAME;
101+
}
102+
99103
getViewType(): string {
100104
return DatabaseCore.FRONTMATTER_KEY;
101105
}
@@ -132,7 +136,7 @@ export class DatabaseView extends TextFileView implements HoverParent {
132136
.addItem((item) => {
133137
item
134138
.setTitle(t("menu_pane_open_db_settings_action"))
135-
.setIcon(DB_ICONS.NAME)
139+
.setIcon("gear")
136140
.onClick(this.settingsAction.bind(this));
137141
})
138142
.addSeparator();
@@ -196,7 +200,7 @@ export class DatabaseView extends TextFileView implements HoverParent {
196200
private initActions(): void {
197201
// Settings action
198202
this.addAction(
199-
DB_ICONS.NAME,
203+
"gear",
200204
`${t("menu_pane_open_db_settings_action")}`,
201205
this.settingsAction.bind(this)
202206
);

src/automations/formula_functions/ScriptFunctions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class ScriptFunctions implements IGenerateObject {
1414
const files =
1515
get_tfiles_from_folder(
1616
this.config.formula_folder_path,
17+
["js"]
1718
);
1819

1920
if (!files) {

src/helpers/FileManagement.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export function resolve_tfolder(folder_str: string): TFolder {
3838
}
3939

4040
export function get_tfiles_from_folder(
41-
folder_str: string
41+
folder_str: string,
42+
fileExtensions: string[] = ["md", "canvas"]
4243
): Array<TFile> {
4344
let folder;
4445
try {
@@ -47,13 +48,19 @@ export function get_tfiles_from_folder(
4748
// Split the string into '/' and remove the last element
4849
folder = resolve_tfolder(folder_str.split("/").slice(0, -1).join("/"));
4950
}
50-
const files: Array<TFile> = [];
51+
let files: Array<TFile> = [];
5152
Vault.recurseChildren(folder, (file: TAbstractFile) => {
5253
if (file instanceof TFile) {
5354
files.push(file);
5455
}
5556
});
5657

58+
if (fileExtensions.length > 0) {
59+
files = files.filter((file) => {
60+
return fileExtensions.includes(file.extension);
61+
});
62+
}
63+
5764
files.sort((a, b) => {
5865
return a.basename.localeCompare(b.basename);
5966
});

0 commit comments

Comments
 (0)