-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.ts
218 lines (191 loc) · 7.06 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
import KindlePlugin from "main";
import { App, PluginSettingTab, Setting } from "obsidian";
export class KindleSettingTab extends PluginSettingTab {
plugin: KindlePlugin;
constructor(app: App, plugin: KindlePlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl("h1", { text: "Kindle settings" });
containerEl.createEl("p", { text: "Set your data for your Kindle. Use your email which is approved by Amazon." });
new Setting(containerEl)
.setName("Author")
.setDesc("Default author for new documents")
.addText((text) =>
text
.setPlaceholder("Obsidian")
.setValue(this.plugin.settings.author)
.onChange(async (value) => {
this.plugin.settings.author = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Email")
.setDesc("Approved Email for your Kindle")
.addText((text) =>
text
.setPlaceholder("you@obsidian.md")
.setValue(this.plugin.settings.sendmail)
.onChange(async (value) => {
this.plugin.settings.sendmail = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Kindlemail")
.setDesc("Your Kindle/PocketBook email")
.addText((text) =>
text
.setPlaceholder("you@kindle.com")
.setValue(this.plugin.settings.kindlemail)
.onChange(async (value) => {
this.plugin.settings.kindlemail = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("SMTP Host")
.setDesc("Your SMTP host (e.g. smtp.gmail.com)")
.addText((text) =>
text
.setPlaceholder("smtp.obsidian.md")
.setValue(this.plugin.settings.smtphost)
.onChange(async (value) => {
this.plugin.settings.smtphost = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("SMTP Port")
.setDesc("Your SMTP port (e.g. 587)")
.addText((text) =>
text
.setPlaceholder("465")
.setValue(this.plugin.settings.port)
.onChange(async (value) => {
this.plugin.settings.port = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("SMTP User")
.setDesc("Username for your SMTP server e.g. your Mailadress")
.addText((text) =>
text
.setPlaceholder("you@obsidian.md")
.setValue(this.plugin.settings.user)
.onChange(async (value) => {
this.plugin.settings.user = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("SMTP Password")
.setDesc("Your SMTP password")
.addText((text) =>
text
.setPlaceholder("********")
.setValue(this.plugin.settings.pass)
.onChange(async (value) => {
this.plugin.settings.pass = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Backend")
.setDesc("Your backendadress (e.g. https://staneks.de/apps/md2mobi/) can be used for free or host your own Backend.")
.addText((text) =>
text
.setPlaceholder("https://ob2ki.com")
.setValue(this.plugin.settings.backend)
.onChange(async (value) => {
this.plugin.settings.backend = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Generate TOC")
.setDesc("Generate Table of Contents.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.toc)
.onChange(async (value) => {
this.plugin.settings.toc = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
containerEl.createEl("hr");
containerEl.createEl("h1", { text: "⭐ Suggested features" });
new Setting(containerEl)
.setName("Pagebreak by '---'")
.setDesc("Suggested feature: Activate pagebreak by '---'")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.pagebreak)
.onChange(async (value) => {
this.plugin.settings.pagebreak = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Markdown merge")
.setDesc("Suggested feature: Merge .md files into one file (adds Kindle: Mergedown command) Plugin reloads after saving.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.mergedown)
.onChange(async (value) => {
this.plugin.settings.mergedown = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
this.app.plugins.unloadPlugin('obsidian-kindle-export');
this.app.plugins.loadPlugin('obsidian-kindle-export');
})
);
new Setting(containerEl)
.setName("Exportpath")
.setDesc("Set the path where you want to export your files to. (e.g. /folder)")
.addText((text) =>
text
.setPlaceholder("/folder")
.setValue(this.plugin.settings.expath)
.onChange(async (value) => {
this.plugin.settings.expath = value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
})
);
new Setting(containerEl)
.setName("Add Ribbon-Icon")
.setDesc("Suggested feature: Add Ribbon-Icon for the Export-Command. Plugin reloads after saving.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.ribbonicon)
.onChange(async (value) => {
this.plugin.settings.ribbonicon= value;
await this.plugin.saveSettings();
console.log(this.plugin.settings);
this.app.plugins.unloadPlugin('obsidian-kindle-export');
this.app.plugins.loadPlugin('obsidian-kindle-export');
})
);
containerEl.createEl("hr");
containerEl.createEl("p", { text: "Host your own Obsidian2Kindle-Converter."});
containerEl.createEl("a", { text: "Fork from Github 🔗", href: "https://github.com/SimeonLukas/Obsidian2Kindle"});
containerEl.createEl("br");
containerEl.createEl("a", { text: "Buy me a ☕", href: "https://www.buymeacoffee.com/simeonlukas"});
}
}