complete the new version for add button

This commit is contained in:
Jiaxin Peng
2023-12-29 00:21:21 +00:00
parent cf08703fea
commit 3123d91e97
9 changed files with 130 additions and 26 deletions

View File

@@ -66,7 +66,7 @@ export class SettingModal extends Modal {
.addOption('none', '')
.addOption('general', i18nConfig.databaseGeneral)
.addOption('next', i18nConfig.databaseNext)
.addOption('custom', i18nConfig.databaseCustom)
// .addOption('custom', i18nConfig.databaseCustom)
.setValue(this.data.databaseFormat)
.onChange(async (value) => {
this.data.databaseFormat = value;
@@ -121,6 +121,31 @@ export class SettingModal extends Modal {
// tag button
this.createSettingEl(nextTabs, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.data.tagButton, 'tagButton')
// add custom title button
new Setting(nextTabs)
.setName(i18nConfig.NotionCustomTitle)
.setDesc(i18nConfig.NotionCustomTitleDesc)
.addToggle((toggle) =>
toggle
.setValue(this.data.CustomTitleButton)
.onChange(async (value) => {
this.data.CustomTitleButton = value;
this.updateSettingEl(CustomNameEl, value)
// this.updateSettingEl(CustomValuesEl, value)
await this.plugin.saveSettings();
await this.plugin.commands.updateCommand();
})
);
// add custom title name
const CustomNameEl = this.createStyleDiv('custom-name', (this.data.CustomTitleButton), nextTabs);
this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.data.CustomTitleName, 'CustomTitleName')
// add api key
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'notionAPI')

View File

@@ -235,6 +235,18 @@ export class ObsidianSettingTab extends PluginSettingTab {
.setName(`${dbDetails.fullName} (${dbDetails.abName})`)
.setDesc(dbDetails.format)
// add a button for preview data
// settingEl
// .addButton((button: ButtonComponent): ButtonComponent => {
// return button
// .setTooltip("Preview Database")
// .setIcon("eye")
// .onClick(async () => {
// this.plugin.previewDatabase(dbDetails);
// });
// });
// settingEl
// .addButton((button: ButtonComponent): ButtonComponent => {
// return button