-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsettings.ts
62 lines (52 loc) · 1.73 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
import EmbedCodeFile from './main';
import { PluginSettingTab, Setting, App } from 'obsidian';
export interface EmbedCodeFileSettings {
includedLanguages: string;
titleBackgroundColor: string;
titleFontColor: string;
}
export const DEFAULT_SETTINGS: EmbedCodeFileSettings = {
includedLanguages: 'c,cs,cpp,java,python,go,ruby,javascript,js,typescript,ts,shell,sh,bash',
titleBackgroundColor: "#00000020",
titleFontColor: ""
}
export class EmbedCodeFileSettingTab extends PluginSettingTab {
plugin: EmbedCodeFile;
constructor(app: App, plugin: EmbedCodeFile) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const {containerEl} = this;
containerEl.empty();
containerEl.createEl('h2', {text: 'Embed Code File Settings'});
new Setting(containerEl)
.setName('Included Languages')
.setDesc('Comma separated list of included languages.')
.addText(text => text
.setPlaceholder('Comma separated list')
.setValue(this.plugin.settings.includedLanguages)
.onChange(async (value) => {
this.plugin.settings.includedLanguages = value;
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.setName("Font color of title")
.addText(text => text
.setPlaceholder('Enter a color')
.setValue(this.plugin.settings.titleFontColor)
.onChange(async (value) => {
this.plugin.settings.titleFontColor = value;
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.setName('Background color of title')
.addText(text => text
.setPlaceholder('#00000020')
.setValue(this.plugin.settings.titleBackgroundColor)
.onChange(async (value) => {
this.plugin.settings.titleBackgroundColor = value;
await this.plugin.saveSettings();
}));
}
}