basic display of modal

This commit is contained in:
Jiaxin Peng
2023-12-26 09:03:29 +00:00
parent 11aaf14c0b
commit 370444fb94
6 changed files with 158 additions and 212 deletions

View File

@@ -66,6 +66,7 @@ export class ObsidianSettingTab extends PluginSettingTab {
this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser')
// add new button
new Setting(containerEl)
@@ -76,7 +77,7 @@ export class ObsidianSettingTab extends PluginSettingTab {
.setTooltip("Add New Database")
.setIcon("plus")
.onClick(async () => {
let modal = new SettingModal(this.plugin);
let modal = new SettingModal(this.app, this.plugin, this);
modal.onClose = () => {
// if (modal.saved) {
@@ -97,141 +98,18 @@ export class ObsidianSettingTab extends PluginSettingTab {
// notion next database settings
// // notion next database settings
//
// const NextTabs = new SettingNextTabs(this.app, this.plugin, this);
//
// NextTabs.display();
//
//
// // General Database Settings
// const GeneralTabs = new SettingGeneralTabs(this.app, this.plugin, this);
//
// GeneralTabs.display();
const NextTabs = new SettingNextTabs(this.app, this.plugin, this);
NextTabs.display();
// containerEl.createEl('h2', { text: i18nConfig.NotionNextSettingHeader })
//
// new Setting(containerEl)
// .setName(i18nConfig.NotionNextButton)
// .setDesc(i18nConfig.NotionNextButtonDesc)
// .addToggle((toggle) =>
// toggle
// .setValue(this.plugin.settings.NextButton)
// .onChange(async (value) => {
// this.plugin.settings.NextButton = value;
//
// this.updateSettingEl(notionAPINextEl, value)
//
// this.updateSettingEl(databaseIDNextEl, value)
//
// await this.plugin.saveSettings();
// await this.plugin.commands.updateCommand();
// })
// );
//
//
// const notionAPINextEl = this.createStyleDiv('api-next', this.plugin.settings.NextButton)
// this.createSettingEl(notionAPINextEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPINext, 'notionAPINext')
//
// const databaseIDNextEl = this.createStyleDiv('databaseID-next', this.plugin.settings.NextButton)
// this.createSettingEl(databaseIDNextEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDNext, 'databaseIDNext')
// General Database Settings
const GeneralTabs = new SettingGeneralTabs(this.app, this.plugin, this);
GeneralTabs.display();
// containerEl.createEl('h2', { text: i18nConfig.NotionGeneralSettingHeader });
//
// // new Setting(containerEl)
// // .setName(i18nConfig.NotYetFinish)
// new Setting(containerEl)
// .setName(i18nConfig.NotionGeneralButton)
// .setDesc(i18nConfig.NotionGeneralButtonDesc)
// .addToggle((toggle) =>
// toggle
// .setValue(this.plugin.settings.GeneralButton)
// .onChange(async (value) => {
// this.plugin.settings.GeneralButton = value;
//
// this.updateSettingEl(tagButtonEl, value)
// this.updateSettingEl(CustomTitleEl, value)
// // name should follow the result of the title button
// if (value) {
// this.updateSettingEl(CustomNameEl, this.plugin.settings.CustomTitleButton)
// this.updateSettingEl(CustomValuesEl, this.plugin.settings.CustomTitleButton)
// } else {
// this.updateSettingEl(CustomNameEl, value)
// this.updateSettingEl(CustomValuesEl, value)
// }
//
// this.updateSettingEl(notionAPIGeneralEl, value)
// this.updateSettingEl(databaseIDGeneralEl, value)
//
//
// await this.plugin.saveSettings();
// await this.plugin.commands.updateCommand();
//
// })
// );
//
// // add the tagButton to control whether to add tags to the general database
// const tagButtonEl = this.createStyleDiv('tag-button', (this.plugin.settings.GeneralButton && this.plugin.settings.CustomTitleButton));
// this.createSettingEl(tagButtonEl, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.plugin.settings.tagButton, 'tagButton')
//
// // Custom Title Button
// const CustomTitleEl = this.createStyleDiv('custom-title', this.plugin.settings.GeneralButton);
// new Setting(CustomTitleEl)
// .setName(i18nConfig.NotionCustomTitle)
// .setDesc(i18nConfig.NotionCustomTitleDesc)
// .addToggle((toggle) =>
// toggle
// .setValue(this.plugin.settings.CustomTitleButton)
// .onChange(async (value) => {
// this.plugin.settings.CustomTitleButton = value;
//
// this.updateSettingEl(CustomNameEl, value)
//
// this.updateSettingEl(CustomValuesEl, value)
//
// await this.plugin.saveSettings();
// await this.plugin.commands.updateCommand();
// })
// );
//
// // Custom Title Name
// const CustomNameEl = this.createStyleDiv('custom-name', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
// this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName, 'CustomTitleName')
//
// // Custom database properties
// const CustomValuesEl = this.createStyleDiv('custom-values', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
// new Setting(CustomValuesEl)
// .setName(i18nConfig.NotionCustomValues)
// .setDesc(i18nConfig.NotionCustomValuesDesc)
// .addTextArea((text) =>
// text
// .setPlaceholder(i18nConfig.NotionCustomValuesText)
// .setValue(this.plugin.settings.CustomValues)
// .onChange(async (value) => {
// this.plugin.settings.CustomValues = value;
// await this.plugin.saveSettings();
// await this.plugin.commands.updateCommand();
// })
// );
// // new Setting(containerEl)
// // .setName("Convert tags(optional)")
// // .setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'")
// // .addToggle((toggle) =>
// // toggle
// // .setValue(this.plugin.settings.allowTags)
// // .onChange(async (value) => {
// // this.plugin.settings.allowTags = value;
// // await this.plugin.saveSettings();
// // })
// // );
//
// const notionAPIGeneralEl = this.createStyleDiv('api-general', this.plugin.settings.GeneralButton);
// this.createSettingEl(notionAPIGeneralEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPIGeneral, 'notionAPIGeneral')
//
//
// const databaseIDGeneralEl = this.createStyleDiv('databaseID-general', this.plugin.settings.GeneralButton);
// this.createSettingEl(databaseIDGeneralEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDGeneral, 'databaseIDGeneral')
// Custom Database Settings