-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings-tab.ts
More file actions
55 lines (48 loc) · 1.89 KB
/
settings-tab.ts
File metadata and controls
55 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { App, PluginSettingTab, Setting } from 'obsidian';
import HabrImporterPlugin from './main';
export class SettingsTab extends PluginSettingTab {
plugin: HabrImporterPlugin;
constructor(app: App, plugin: HabrImporterPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
new Setting(containerEl)
.setName('Target folder')
.setDesc('Vault folder where Markdown files will be saved.')
.addText((text) =>
text
.setPlaceholder('Habr')
.setValue(this.plugin.settings.saveFolder)
.onChange(async (value) => {
this.plugin.settings.saveFolder = value.trim();
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Images folder')
.setDesc('Vault folder where images will be stored.')
.addText((text) =>
text
.setPlaceholder('Habr images')
.setValue(this.plugin.settings.imagesFolder)
.onChange(async (value) => {
this.plugin.settings.imagesFolder = value.trim();
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName('Open after import')
.setDesc('Automatically open the imported article.')
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.openAfterImport)
.onChange(async (value) => {
this.plugin.settings.openAfterImport = value;
await this.plugin.saveSettings();
}),
);
}
}