added settings tab

This commit is contained in:
Ell 2023-08-17 11:56:40 +02:00
parent 0717165809
commit 76b819f84a
2 changed files with 29 additions and 3 deletions

View file

@ -14,8 +14,34 @@ export class JSPSettingsTab extends PluginSettingTab {
display(): void {
this.containerEl.empty();
this.containerEl.createEl("h2", {text: "Just Share Please Settings"});
// TODO settings
new Setting(this.containerEl)
.setName("Just Share Please Server")
.setDesc(createFragment(f => {
f.createSpan({text: "URL for the Just Share Please server to upload to and share links for. Defaults to the official server at "});
f.createEl("a", {text: "jsp.ellpeck.de", href: defaultSettings.url});
f.createSpan({text: ". For more info on self-hosting, see "});
f.createEl("a", {text: "the README on GitHub", href: "https://github.com/Ellpeck/ObsidianJustSharePlease/blob/main/README.md"});
f.createSpan({text: "."});
}))
.addText(t => {
t.setValue(String(this.plugin.settings.url));
t.onChange(async v => {
this.plugin.settings.url = v || defaultSettings.url;
await this.plugin.saveSettings();
});
});
new Setting(this.containerEl)
.setName("Strip Frontmatter")
.setDesc("Whether document frontmatter (also known as properties) should be removed from the uploaded share.")
.addToggle(t => {
t.setValue(this.plugin.settings.stripFrontmatter);
t.onChange(async v => {
this.plugin.settings.stripFrontmatter = v;
await this.plugin.saveSettings();
});
});
this.containerEl.createEl("hr");
this.containerEl.createEl("p", {text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!"});

View file

@ -1,5 +1,5 @@
export const defaultSettings: JSPSettings = {
url: "http://localhost:8080",
url: "https://jsp.ellpeck.de",
shared: [],
stripFrontmatter: true
};