mirror of
https://github.com/dnlbauer/obsidian-dataview-autocompletion.git
synced 2026-09-11 22:55:30 +00:00
add option to exclude fields
This commit is contained in:
39
src/SettingsTab.ts
Normal file
39
src/SettingsTab.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
import DataviewAutocompletePlugin from "./main";
|
||||
|
||||
export class SettingsTab extends PluginSettingTab {
|
||||
plugin: DataviewAutocompletePlugin;
|
||||
|
||||
constructor(app: App, plugin: DataviewAutocompletePlugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
display(): void {
|
||||
let { containerEl } = this;
|
||||
containerEl.empty();
|
||||
|
||||
const excludeDesc = document.createDocumentFragment();
|
||||
const link = document.createElement("a");
|
||||
link.href = "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions";
|
||||
link.text = "Regex patterns";
|
||||
excludeDesc.append(link);
|
||||
excludeDesc.append(" to exclude field names from suggestions. One pattern per line.");
|
||||
new Setting(containerEl)
|
||||
.setName("Exclude fields")
|
||||
.setDesc(excludeDesc)
|
||||
.addTextArea((textArea) => {
|
||||
textArea.inputEl.setAttribute("rows", "5");
|
||||
textArea
|
||||
.setPlaceholder("created.*\nmodified.*\ndate")
|
||||
.setValue(this.plugin.settings.ignoredFields.join("\n"))
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.ignoredFields = value
|
||||
.split("\n")
|
||||
.map((val) => val.trim())
|
||||
.filter((val) => val.length > 0);
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user