-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.ts
79 lines (78 loc) · 3.04 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
import { PluginSettingTab, Notice, Platform, Setting } from "obsidian";
import Opener from "./main";
export class OpenerSettingTab extends PluginSettingTab {
display(): void {
const { containerEl } = this;
const plugin: Opener = (this as any).plugin;
containerEl.empty();
new Setting(containerEl)
.setName("New Tab Default")
.setDesc(
"Enable to open new files in a new tab (or existing tab, if it was previously opened). Disable for default Obsidian behavior."
)
.addToggle((toggle) =>
toggle.setValue(plugin.settings.newTab).onChange((value) => {
plugin.settings.newTab = value;
plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("PDF Default App")
.setDesc(
"Enable to open pdfs with system viewer app. Disable for default behavior (open pdfs in Obsidian)."
)
.addToggle((toggle) =>
toggle.setValue(plugin.settings.PDFApp).onChange((value) => {
plugin.settings.PDFApp = value;
plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Default app only when Ctrl/Cmd-Key is held")
.setDesc(
"Open in default app only when Ctrl/Cmd-Key is held. Disable to always‚ open with system viewer."
)
.addToggle((toggle) =>
toggle.setValue(plugin.settings.extOnlyWhenMetaKey).onChange((value) => {
plugin.settings.extOnlyWhenMetaKey = value;
plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Open everything outside of Obsidian")
.setDesc(
"Enable to open all obsidian supported extensions with system viewer instead. Disable for default behavior (open within Obsidian). Defaults supported extensions are 'png', 'webp', 'jpg', 'jpeg', 'gif', 'bmp', 'svg', 'mp3', 'webm', 'wav', 'm4a', 'ogg','3gp', 'flac', 'mp4', 'ogv', 'mov', 'mkv'."
)
.addToggle((toggle) =>
toggle.setValue(plugin.settings.allExt).onChange((value) => {
plugin.settings.allExt = value;
plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Open Outside Obsidian: Manual List")
.setDesc("This shouldn't be necessary, but you can manually enable custom extensions here.")
.addToggle((toggle) =>
toggle.setValue(plugin.settings.custExt).onChange((value) => {
plugin.settings.custExt = value;
plugin.saveSettings();
this.display();
})
);
if (plugin.settings.custExt) {
new Setting(containerEl)
.setName("Manual List")
.setDesc("Enter extension names (without the dot, ie, just docx separated by newlines).")
.addTextArea((textArea) => {
textArea.inputEl.rows = 5;
textArea
.setValue(plugin.settings.custExtList.join('\n'))
.onChange(async (value) => {
plugin.settings.custExtList = value.split('\n');
plugin.saveSettings();
});
})
.settingEl.style.borderTop = "none";
}
}
}