-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsettings.ts
101 lines (92 loc) · 3.09 KB
/
settings.ts
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import FolderFocusModePlugin from "main";
import { App, PluginSettingTab, Setting } from "obsidian";
export class FolderFocusModeSettingTab extends PluginSettingTab {
plugin: FolderFocusModePlugin;
constructor(app: App, plugin: FolderFocusModePlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
new Setting(containerEl)
.setName("Auto-Focus when hidden")
.setDesc("Ensures the plugin focuses automatically on directory of newly opened files, if they are not visible right now")
.addToggle((component) =>
component
.setValue(this.plugin.settings.autofocusMode)
.onChange(async (value) => {
this.plugin.settings.autofocusMode = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Auto-Focus on root")
.setDesc("Focus on the first folder from root if the auto focus setting is enabled")
.addToggle((component) =>
component
.setValue(this.plugin.settings.autofocusRoot)
.onChange(async (value) => {
this.plugin.settings.autofocusRoot = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Force auto-focus on parent directory")
.setDesc("Always auto-focus on the parent directory of current file, even if it is already visible")
.addToggle((component) =>
component
.setValue(this.plugin.settings.autofocusForced)
.onChange(async (value) => {
this.plugin.settings.autofocusForced = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Simplified view")
.setDesc("Hide parent directories when focusing on a folder (saves space when using nested folders)")
.addToggle((component) =>
component
.setValue(this.plugin.settings.simplifiedView)
.onChange(async (value) => {
this.plugin.settings.simplifiedView = value;
this.plugin.resetClasses();
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Button on explorer")
.setDesc("Add a button on the top of the file explorer")
.addToggle((component)=>
component
.setValue(this.plugin.settings.focusButton)
.onChange(async(value)=>{
this.plugin.settings.focusButton=value;
this.plugin.initialiseFocusButton(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Show focus option on file context menu")
.setDesc("Show \"Focus on this file\" option in file context menu")
.addToggle((component)=>
component
.setValue(this.plugin.settings.fileContextMenu)
.onChange(async(value)=>{
this.plugin.settings.fileContextMenu=value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName('Folder Note: External files')
.setDesc('Focus on the folder linked with the folder note')
.addToggle((component)=>
component
.setValue(this.plugin.settings.focusNote)
.onChange(async(value)=>{
this.plugin.settings.focusNote=value;
await this.plugin.saveSettings();
})
);
}
}