add siteUrl and micropubEndpoint settings
This commit is contained in:
parent
bc65633b92
commit
c0e995819b
|
@ -3,6 +3,12 @@
|
|||
*/
|
||||
export interface StoredSettings {
|
||||
|
||||
// Application url used to access the site
|
||||
siteUrl: string
|
||||
|
||||
// The site's micropub endpoint
|
||||
micropubEndpoint: string
|
||||
|
||||
// Application token used to access Micro.blog.
|
||||
appToken: string
|
||||
|
||||
|
@ -27,6 +33,8 @@ export interface StoredSettings {
|
|||
|
||||
// Default values for the plugin.
|
||||
export const defaultSettings: StoredSettings = {
|
||||
siteUrl: '',
|
||||
micropubEndpoint: '',
|
||||
appToken: '',
|
||||
defaultTags: '',
|
||||
postVisibility: 'draft',
|
||||
|
|
|
@ -100,6 +100,28 @@ export class MicroPluginSettingsView extends PluginSettingTab implements MicroPl
|
|||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Site URL')
|
||||
.setDesc('Your site\'s full address, eg. https://example.com.')
|
||||
.addText(text => text
|
||||
.setPlaceholder('https://example.com')
|
||||
.setValue(this.viewModel.siteUrl)
|
||||
.onChange(value => {
|
||||
this.viewModel.siteUrl = value
|
||||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Micropub Endpoint')
|
||||
.setDesc('Your site\'s micropub endpoint.')
|
||||
.addText(text => text
|
||||
.setPlaceholder('https://example.com/micropub')
|
||||
.setValue(this.viewModel.micropubEndpoint)
|
||||
.onChange(value => {
|
||||
this.viewModel.micropubEndpoint = value
|
||||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.addButton(button => button
|
||||
.setButtonText('Log in')
|
||||
|
|
|
@ -69,6 +69,24 @@ export class MicroPluginSettingsViewModel {
|
|||
this.plugin.saveSettings()
|
||||
}
|
||||
|
||||
public get siteUrl(): string {
|
||||
return this.settings.siteUrl
|
||||
}
|
||||
|
||||
public set siteUrl(value: string) {
|
||||
this.settings.siteUrl = value
|
||||
this.plugin.saveSettings()
|
||||
}
|
||||
|
||||
public get micropubEndpoint(): string {
|
||||
return this.settings.micropubEndpoint
|
||||
}
|
||||
|
||||
public set micropubEndpoint(value: string) {
|
||||
this.settings.micropubEndpoint = value
|
||||
this.plugin.saveSettings()
|
||||
}
|
||||
|
||||
public get tags(): string {
|
||||
return this.settings.defaultTags
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue