mirror of
https://github.com/d7sd6u/obsidian-crosslink-advanced.git
synced 2026-07-22 05:41:20 +00:00
feat: add FolderSuggest for inbox setting
This commit is contained in:
parent
6faa714cf0
commit
59bc09e546
2 changed files with 14 additions and 9 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6d64559440fa42f765db2906d5f74af3eed0ada8
|
Subproject commit fb589401f0ba76fab5c01bab8b63684ceeff3290
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { App, PluginSettingTab, Setting } from "obsidian";
|
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||||
import Main from "./main";
|
import Main from "./main";
|
||||||
|
import { FolderSuggest } from "../obsidian-reusables/src/FolderSuggest";
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS = {
|
export const DEFAULT_SETTINGS = {
|
||||||
inbox: "Uncategorized",
|
inbox: "Uncategorized",
|
||||||
|
|
@ -13,6 +14,8 @@ export class MainPluginSettingsTab extends PluginSettingTab {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suggest?: FolderSuggest;
|
||||||
|
|
||||||
display() {
|
display() {
|
||||||
const { containerEl } = this;
|
const { containerEl } = this;
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
@ -20,17 +23,19 @@ export class MainPluginSettingsTab extends PluginSettingTab {
|
||||||
this.app.vault.getAllFolders().map((v) => [v.path, v.path]),
|
this.app.vault.getAllFolders().map((v) => [v.path, v.path]),
|
||||||
);
|
);
|
||||||
options["/"] = "/";
|
options["/"] = "/";
|
||||||
|
|
||||||
|
const setInbox = async (v: string) => {
|
||||||
|
this.plugin.settings.inbox = v;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
};
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("Inbox folder")
|
.setName("Inbox folder")
|
||||||
.setDesc("Folder where notes without explicit ftags are stored")
|
.setDesc("Folder where notes without explicit ftags are stored")
|
||||||
.addDropdown((textArea) => {
|
.addSearch((search) => {
|
||||||
textArea
|
search.setValue(this.plugin.settings.inbox).onChange(setInbox);
|
||||||
.addOptions(options)
|
this.suggest = new FolderSuggest(this.app, search.inputEl);
|
||||||
.setValue(this.plugin.settings.inbox)
|
this.suggest.onSelect((v) => setInbox(v.path));
|
||||||
.onChange(async (v) => {
|
|
||||||
this.plugin.settings.inbox = v;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue