From 399a02187f41503a368b0a9b9ee5719b5d7caaf5 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Tue, 14 Nov 2023 15:42:30 +0000 Subject: [PATCH 01/10] update packages and complete the setting UI --- package.json | 16 +- src/lang/I18n.ts | 12 +- src/ui/settingTabs.ts | 173 +++++++++++++-------- yarn.lock | 354 +++++++++++++++++++++--------------------- 4 files changed, 307 insertions(+), 248 deletions(-) diff --git a/package.json b/package.json index b23ce5a..553d190 100644 --- a/package.json +++ b/package.json @@ -14,21 +14,21 @@ "license": "GNU GPLv3", "devDependencies": { "@types/node": "^20.5.7", - "@types/yaml-front-matter": "^4.1.0", - "@typescript-eslint/eslint-plugin": "^6.5.0", - "@typescript-eslint/parser": "^6.5.0", + "@types/yaml-front-matter": "^4.1.3", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", "builtin-modules": "^3.2.0", - "esbuild": "0.19.2", + "esbuild": "0.19.5", "obsidian": "latest", "tslib": "2.6.2", "typescript": "5.2.2" }, "dependencies": { - "@tryfabric/martian": "^1.2.0", - "https-proxy-agent": "^7.0.1", + "@tryfabric/martian": "^1.2.4", + "https-proxy-agent": "^7.0.2", "process": "^0.11.10", "remark-math": "^6.0.0", - "yaml": "^2.2.2", + "yaml": "^2.3.4", "yaml-front-matter": "^4.1.1" } -} \ No newline at end of file +} diff --git a/src/lang/I18n.ts b/src/lang/I18n.ts index e50e0c3..e5fe195 100644 --- a/src/lang/I18n.ts +++ b/src/lang/I18n.ts @@ -25,6 +25,11 @@ export const I18n: { [key: string]: any } = { NotionGeneralSettingHeader: "General Notion Database Settings", NotionGeneralButton: "Notion General command switch", NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette", + NotionCustomTitle: "Customise column name", + NotionCustomTitleDesc: "Modify the column name of the Notion database, default (off)", + NotionCustomTitleName: "Preferred title name", + NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database", + NotionCustomTitleText: "Enter the name", NotYetFinish: "Not finished. This function will be available in the next version", PlaceHolder: "Enter database Name", @@ -72,7 +77,12 @@ export const I18n: { [key: string]: any } = { NotionGeneralSettingHeader: "普通 Notion 数据库设置", NotionGeneralButton: "普通数据库同步命令开关", NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中", - NotYetFinish: "未完成。此功能将在之后版本中提供", + NotionCustomTitle: "修改 Notion 数据库表头开关", + NotionCustomTitleDesc: "自定义Notion 数据库第一列表头,默认关闭", + NotionCustomTitleName: "想要修改的表头名", + NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名", + NotionCustomTitleText: "输入表头名", + NotYetFinish: "未完成。此功能将在之后版本中提供", PlaceHolder: "输入数据库名称", "notion-logo": "分享到NotionNext", "sync-success": "同步到NotionNext成功:\n", diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 6fb5c3c..95ca328 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -1,5 +1,5 @@ -import {App, PluginSettingTab, Setting} from "obsidian"; -import {i18nConfig} from "../lang/I18n"; +import { App, PluginSettingTab, Setting } from "obsidian"; +import { i18nConfig } from "../lang/I18n"; import ObsidianSyncNotionPlugin from "../main"; export interface PluginSettings { @@ -9,12 +9,14 @@ export interface PluginSettings { bannerUrl: string; notionUser: string; proxy: string; - GeneralButton: boolean; + GeneralButton: boolean; + CustomTitleButton: boolean; + CustomTitleName: string; notionAPIGeneral: string; databaseIDGeneral: string; - CustomButton: boolean; - notionAPICustom: string; - databaseIDCustom: string; + CustomButton: boolean; + notionAPICustom: string; + databaseIDCustom: string; } export const DEFAULT_SETTINGS: PluginSettings = { @@ -24,12 +26,14 @@ export const DEFAULT_SETTINGS: PluginSettings = { bannerUrl: "", notionUser: "", proxy: "", - GeneralButton: true, + GeneralButton: true, + CustomTitleButton: false, + CustomTitleName: "", notionAPIGeneral: "", databaseIDGeneral: "", - CustomButton: false, - notionAPICustom: "", - databaseIDCustom: "", + CustomButton: false, + notionAPICustom: "", + databaseIDCustom: "", }; @@ -42,11 +46,11 @@ export class ObsidianSettingTab extends PluginSettingTab { } display(): void { - const {containerEl} = this; + const { containerEl } = this; containerEl.empty(); - containerEl.createEl('h2', {text: i18nConfig.GeneralSetting}) + containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }) new Setting(containerEl) .setName(i18nConfig.BannerUrl) @@ -75,20 +79,20 @@ export class ObsidianSettingTab extends PluginSettingTab { }) ); - containerEl.createEl('h2', {text: i18nConfig.NotionNextSettingHeader}) + 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; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - }) - ); + 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; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ); new Setting(containerEl) .setName(i18nConfig.NotionAPI) @@ -109,38 +113,83 @@ export class ObsidianSettingTab extends PluginSettingTab { .setName(i18nConfig.DatabaseID) .setDesc(i18nConfig.NotionAPIDesc) .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.DatabaseIDText) - .setValue(this.plugin.settings.databaseIDNext) - .onChange(async (value) => { - this.plugin.settings.databaseIDNext = value; - await this.plugin.saveSettings(); - }) - } + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.DatabaseIDText) + .setValue(this.plugin.settings.databaseIDNext) + .onChange(async (value) => { + this.plugin.settings.databaseIDNext = value; + await this.plugin.saveSettings(); + }) + } ); // notionDatabaseID.controlEl.querySelector('input').type='password' // General Database Settings - containerEl.createEl('h2', {text: i18nConfig.NotionGeneralSettingHeader}); + 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; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ); + new Setting(containerEl) - .setName(i18nConfig.NotionGeneralButton) - .setDesc(i18nConfig.NotionGeneralButtonDesc) + .setName(i18nConfig.NotionCustomTitle) + .setDesc(i18nConfig.NotionCustomTitleDesc) .addToggle((toggle) => toggle - .setValue(this.plugin.settings.GeneralButton) + .setValue(this.plugin.settings.CustomTitleButton) .onChange(async (value) => { - this.plugin.settings.GeneralButton = value; + this.plugin.settings.CustomTitleButton = value; await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); + + // Clear existing components + dynamicSettingContainer.empty(); + + // Add new components based on the toggle value + if (this.plugin.settings.CustomTitleButton) { + new Setting(dynamicSettingContainer) + .setName(i18nConfig.NotionCustomTitleName) + .setDesc(i18nConfig.NotionCustomTitleNameDesc) + .addText((text) => + text + .setPlaceholder(i18nConfig.NotionCustomTitleText) + .setValue(this.plugin.settings.CustomTitleName) + .onChange(async (value) => { + this.plugin.settings.CustomTitleName = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ); + dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; + } else { + dynamicSettingContainer.style.borderTop = "none"; + dynamicSettingContainer.style.paddingTop = "0"; + } }) ); + const dynamicSettingContainer = containerEl.createDiv('setting-popover', (div) => { + div.style.display = "flex"; + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + }); + // new Setting(containerEl) // .setName("Convert tags(optional)") // .setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'") @@ -171,31 +220,31 @@ export class ObsidianSettingTab extends PluginSettingTab { .setName(i18nConfig.DatabaseID) .setDesc(i18nConfig.NotionAPIDesc) .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionIDText) - .setValue(this.plugin.settings.databaseIDGeneral) - .onChange(async (value) => { - this.plugin.settings.databaseIDGeneral = value; - await this.plugin.saveSettings(); - }) - } + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionIDText) + .setValue(this.plugin.settings.databaseIDGeneral) + .onChange(async (value) => { + this.plugin.settings.databaseIDGeneral = value; + await this.plugin.saveSettings(); + }) + } ); - // Custom Database Settings + // Custom Database Settings - // containerEl.createEl('h2', {text: i18nConfig.NotionCustomSettingHeader}); - // - // new Setting(containerEl) - // .setName(i18nConfig.NotionCustomButton) - // .setDesc(i18nConfig.NotionCustomButtonDesc) - // .addToggle((toggle) => - // toggle - // .setValue(this.plugin.settings.CustomButton) - // .onChange(async (value) => { - // this.plugin.settings.CustomButton = value; - // await this.plugin.saveSettings(); - // }) - // ); + // containerEl.createEl('h2', {text: i18nConfig.NotionCustomSettingHeader}); + // + // new Setting(containerEl) + // .setName(i18nConfig.NotionCustomButton) + // .setDesc(i18nConfig.NotionCustomButtonDesc) + // .addToggle((toggle) => + // toggle + // .setValue(this.plugin.settings.CustomButton) + // .onChange(async (value) => { + // this.plugin.settings.CustomButton = value; + // await this.plugin.saveSettings(); + // }) + // ); } } diff --git a/yarn.lock b/yarn.lock index 9e3e83c..696cd9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,115 +2,115 @@ # yarn lockfile v1 -"@esbuild/android-arm64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz#bc35990f412a749e948b792825eef7df0ce0e073" - integrity sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw== +"@esbuild/android-arm64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz#276c5f99604054d3dbb733577e09adae944baa90" + integrity sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ== -"@esbuild/android-arm@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.2.tgz#edd1c8f23ba353c197f5b0337123c58ff2a56999" - integrity sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q== +"@esbuild/android-arm@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.5.tgz#4a3cbf14758166abaae8ba9c01a80e68342a4eec" + integrity sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA== -"@esbuild/android-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.2.tgz#2dcdd6e6f1f2d82ea1b746abd8da5b284960f35a" - integrity sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w== +"@esbuild/android-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.5.tgz#21a3d11cd4613d2d3c5ccb9e746c254eb9265b0a" + integrity sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA== -"@esbuild/darwin-arm64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz#55b36bc06d76f5c243987c1f93a11a80d8fc3b26" - integrity sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA== +"@esbuild/darwin-arm64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz#714cb839f467d6a67b151ee8255886498e2b9bf6" + integrity sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw== -"@esbuild/darwin-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz#982524af33a6424a3b5cb44bbd52559623ad719c" - integrity sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw== +"@esbuild/darwin-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz#2c553e97a6d2b4ae76a884e35e6cbab85a990bbf" + integrity sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA== -"@esbuild/freebsd-arm64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz#8e478a0856645265fe79eac4b31b52193011ee06" - integrity sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ== +"@esbuild/freebsd-arm64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz#d554f556718adb31917a0da24277bf84b6ee87f3" + integrity sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ== -"@esbuild/freebsd-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz#01b96604f2540db023c73809bb8ae6cd1692d6f3" - integrity sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw== +"@esbuild/freebsd-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz#288f7358a3bb15d99e73c65c9adaa3dabb497432" + integrity sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ== -"@esbuild/linux-arm64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz#7e5d2c7864c5c83ec789b59c77cd9c20d2594916" - integrity sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg== +"@esbuild/linux-arm64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz#95933ae86325c93cb6b5e8333d22120ecfdc901b" + integrity sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA== -"@esbuild/linux-arm@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz#c32ae97bc0246664a1cfbdb4a98e7b006d7db8ae" - integrity sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg== +"@esbuild/linux-arm@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz#0acef93aa3e0579e46d33b666627bddb06636664" + integrity sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ== -"@esbuild/linux-ia32@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz#3fc4f0fa026057fe885e4a180b3956e704f1ceaa" - integrity sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ== +"@esbuild/linux-ia32@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz#b6e5c9e80b42131cbd6b1ddaa48c92835f1ed67f" + integrity sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ== -"@esbuild/linux-loong64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz#633bcaea443f3505fb0ed109ab840c99ad3451a4" - integrity sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw== +"@esbuild/linux-loong64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz#e5f0cf95a180158b01ff5f417da796a1c09dfbea" + integrity sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw== -"@esbuild/linux-mips64el@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz#e0bff2898c46f52be7d4dbbcca8b887890805823" - integrity sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg== +"@esbuild/linux-mips64el@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz#ae36fb86c7d5f641f3a0c8472e83dcb6ea36a408" + integrity sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg== -"@esbuild/linux-ppc64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz#d75798da391f54a9674f8c143b9a52d1dbfbfdde" - integrity sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw== +"@esbuild/linux-ppc64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz#7960cb1666f0340ddd9eef7b26dcea3835d472d0" + integrity sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q== -"@esbuild/linux-riscv64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz#012409bd489ed1bb9b775541d4a46c5ded8e6dd8" - integrity sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw== +"@esbuild/linux-riscv64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz#32207df26af60a3a9feea1783fc21b9817bade19" + integrity sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag== -"@esbuild/linux-s390x@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz#ece3ed75c5a150de8a5c110f02e97d315761626b" - integrity sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g== +"@esbuild/linux-s390x@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz#b38d5681db89a3723862dfa792812397b1510a7d" + integrity sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw== -"@esbuild/linux-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz#dea187019741602d57aaf189a80abba261fbd2aa" - integrity sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ== +"@esbuild/linux-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz#46feba2ad041a241379d150f415b472fe3885075" + integrity sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A== -"@esbuild/netbsd-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz#bbfd7cf9ab236a23ee3a41b26f0628c57623d92a" - integrity sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ== +"@esbuild/netbsd-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz#3b5c1fb068f26bfc681d31f682adf1bea4ef0702" + integrity sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g== -"@esbuild/openbsd-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz#fa5c4c6ee52a360618f00053652e2902e1d7b4a7" - integrity sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw== +"@esbuild/openbsd-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz#ca6830316ca68056c5c88a875f103ad3235e00db" + integrity sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA== -"@esbuild/sunos-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz#52a2ac8ac6284c02d25df22bb4cfde26fbddd68d" - integrity sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw== +"@esbuild/sunos-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz#9efc4eb9539a7be7d5a05ada52ee43cda0d8e2dd" + integrity sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg== -"@esbuild/win32-arm64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz#719ed5870855de8537aef8149694a97d03486804" - integrity sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg== +"@esbuild/win32-arm64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz#29f8184afa7a02a956ebda4ed638099f4b8ff198" + integrity sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg== -"@esbuild/win32-ia32@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz#24832223880b0f581962c8660f8fb8797a1e046a" - integrity sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA== +"@esbuild/win32-ia32@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz#f3de07afb292ecad651ae4bb8727789de2d95b05" + integrity sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw== -"@esbuild/win32-x64@0.19.2": - version "0.19.2" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz#1205014625790c7ff0e471644a878a65d1e34ab0" - integrity sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw== +"@esbuild/win32-x64@0.19.5": + version "0.19.5" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz#faad84c41ba12e3a0acb52571df9bff37bee75f6" + integrity sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw== "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -153,7 +153,7 @@ "@types/node-fetch" "^2.5.10" node-fetch "^2.6.1" -"@tryfabric/martian@^1.2.0": +"@tryfabric/martian@^1.2.4": version "1.2.4" resolved "https://registry.yarnpkg.com/@tryfabric/martian/-/martian-1.2.4.tgz#3fdfe7129f1c28bccddc34854cf353b0f37c0c02" integrity sha512-g7SP7beaxrjxLnW//vskra07a1jsJowqp07KMouxh4gCwaF+ItHbRZN8O+1dhJivBi3VdasT71BPyk+8wzEreQ== @@ -259,24 +259,24 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.7.tgz#5b06ad6894b236a1d2bd6b2f07850ca5c59cf4d6" integrity sha512-cputDpIbFgLUaGQn6Vqg3/YsJwxUwHLO13v3i5ouxT4lat0khip9AEWxtERujXV9wxIB1EyF97BSJFt6vpdI8g== -"@types/yaml-front-matter@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@types/yaml-front-matter/-/yaml-front-matter-4.1.0.tgz#324404e069353972286bf60117f8b404b7cb0220" - integrity sha512-d4YGe2onl1T4VA6QhT4agdxaStOBe/ig9RAFAT1OltytvO2z9Ro69DiwHD2FUwewcjeD9PWEfUeZhw7E9hApcQ== +"@types/yaml-front-matter@^4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@types/yaml-front-matter/-/yaml-front-matter-4.1.3.tgz#76478882b5ee3e892dd2ee2af86a6dd8c089ce4d" + integrity sha512-XDsnZdIZ8QGRFzfRTCSxjbm0NGQQfFPxk2zqy0DB4SH2TXJVptzdY+IgDNM1K2ZIjFvFaHo2l5wJd71JzMeI9A== dependencies: "@types/js-yaml" "*" "@types/node" "*" -"@typescript-eslint/eslint-plugin@^6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz#5cee33edf0d45d5ec773e3b3111206b098ac8599" - integrity sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw== +"@typescript-eslint/eslint-plugin@^6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.11.0.tgz#52aae65174ff526576351f9ccd41cea01001463f" + integrity sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.5.0" - "@typescript-eslint/type-utils" "6.5.0" - "@typescript-eslint/utils" "6.5.0" - "@typescript-eslint/visitor-keys" "6.5.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/type-utils" "6.11.0" + "@typescript-eslint/utils" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -284,72 +284,72 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/parser@^6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.5.0.tgz#3d6ed231c5e307c5f5f4a0d86893ec01e92b8c77" - integrity sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ== +"@typescript-eslint/parser@^6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.11.0.tgz#9640d9595d905f3be4f278bf515130e6129b202e" + integrity sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ== dependencies: - "@typescript-eslint/scope-manager" "6.5.0" - "@typescript-eslint/types" "6.5.0" - "@typescript-eslint/typescript-estree" "6.5.0" - "@typescript-eslint/visitor-keys" "6.5.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/typescript-estree" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz#f2cb20895aaad41b3ad27cc3a338ce8598f261c5" - integrity sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw== +"@typescript-eslint/scope-manager@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz#621f603537c89f4d105733d949aa4d55eee5cea8" + integrity sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A== dependencies: - "@typescript-eslint/types" "6.5.0" - "@typescript-eslint/visitor-keys" "6.5.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" -"@typescript-eslint/type-utils@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz#6d246c93739282bc0d2e623f28d0dec6cfcc38d7" - integrity sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A== +"@typescript-eslint/type-utils@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.11.0.tgz#d0b8b1ab6c26b974dbf91de1ebc5b11fea24e0d1" + integrity sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA== dependencies: - "@typescript-eslint/typescript-estree" "6.5.0" - "@typescript-eslint/utils" "6.5.0" + "@typescript-eslint/typescript-estree" "6.11.0" + "@typescript-eslint/utils" "6.11.0" debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/types@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.5.0.tgz#f4e55cfd99ac5346ea772770bf212a3e689a8f04" - integrity sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w== +"@typescript-eslint/types@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.11.0.tgz#8ad3aa000cbf4bdc4dcceed96e9b577f15e0bf53" + integrity sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA== -"@typescript-eslint/typescript-estree@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz#1cef6bc822585e9ef89d88834bc902d911d747ed" - integrity sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ== +"@typescript-eslint/typescript-estree@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz#7b52c12a623bf7f8ec7f8a79901b9f98eb5c7990" + integrity sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ== dependencies: - "@typescript-eslint/types" "6.5.0" - "@typescript-eslint/visitor-keys" "6.5.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/visitor-keys" "6.11.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.5.0.tgz#6668bee4f7f24978b11df8a2ea42d56eebc4662c" - integrity sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ== +"@typescript-eslint/utils@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.11.0.tgz#11374f59ef4cea50857b1303477c08aafa2ca604" + integrity sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.5.0" - "@typescript-eslint/types" "6.5.0" - "@typescript-eslint/typescript-estree" "6.5.0" + "@typescript-eslint/scope-manager" "6.11.0" + "@typescript-eslint/types" "6.11.0" + "@typescript-eslint/typescript-estree" "6.11.0" semver "^7.5.4" -"@typescript-eslint/visitor-keys@6.5.0": - version "6.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz#1a6f474a0170a447b76f0699ce6700110fd11436" - integrity sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA== +"@typescript-eslint/visitor-keys@6.11.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz#d991538788923f92ec40d44389e7075b359f3458" + integrity sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ== dependencies: - "@typescript-eslint/types" "6.5.0" + "@typescript-eslint/types" "6.11.0" eslint-visitor-keys "^3.4.1" agent-base@^7.0.2: @@ -483,33 +483,33 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" -esbuild@0.19.2: - version "0.19.2" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.2.tgz#b1541828a89dfb6f840d38538767c6130dca2aac" - integrity sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg== +esbuild@0.19.5: + version "0.19.5" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.5.tgz#53a0e19dfbf61ba6c827d51a80813cf071239a8c" + integrity sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ== optionalDependencies: - "@esbuild/android-arm" "0.19.2" - "@esbuild/android-arm64" "0.19.2" - "@esbuild/android-x64" "0.19.2" - "@esbuild/darwin-arm64" "0.19.2" - "@esbuild/darwin-x64" "0.19.2" - "@esbuild/freebsd-arm64" "0.19.2" - "@esbuild/freebsd-x64" "0.19.2" - "@esbuild/linux-arm" "0.19.2" - "@esbuild/linux-arm64" "0.19.2" - "@esbuild/linux-ia32" "0.19.2" - "@esbuild/linux-loong64" "0.19.2" - "@esbuild/linux-mips64el" "0.19.2" - "@esbuild/linux-ppc64" "0.19.2" - "@esbuild/linux-riscv64" "0.19.2" - "@esbuild/linux-s390x" "0.19.2" - "@esbuild/linux-x64" "0.19.2" - "@esbuild/netbsd-x64" "0.19.2" - "@esbuild/openbsd-x64" "0.19.2" - "@esbuild/sunos-x64" "0.19.2" - "@esbuild/win32-arm64" "0.19.2" - "@esbuild/win32-ia32" "0.19.2" - "@esbuild/win32-x64" "0.19.2" + "@esbuild/android-arm" "0.19.5" + "@esbuild/android-arm64" "0.19.5" + "@esbuild/android-x64" "0.19.5" + "@esbuild/darwin-arm64" "0.19.5" + "@esbuild/darwin-x64" "0.19.5" + "@esbuild/freebsd-arm64" "0.19.5" + "@esbuild/freebsd-x64" "0.19.5" + "@esbuild/linux-arm" "0.19.5" + "@esbuild/linux-arm64" "0.19.5" + "@esbuild/linux-ia32" "0.19.5" + "@esbuild/linux-loong64" "0.19.5" + "@esbuild/linux-mips64el" "0.19.5" + "@esbuild/linux-ppc64" "0.19.5" + "@esbuild/linux-riscv64" "0.19.5" + "@esbuild/linux-s390x" "0.19.5" + "@esbuild/linux-x64" "0.19.5" + "@esbuild/netbsd-x64" "0.19.5" + "@esbuild/openbsd-x64" "0.19.5" + "@esbuild/sunos-x64" "0.19.5" + "@esbuild/win32-arm64" "0.19.5" + "@esbuild/win32-ia32" "0.19.5" + "@esbuild/win32-x64" "0.19.5" escape-string-regexp@^4.0.0: version "4.0.0" @@ -589,10 +589,10 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -https-proxy-agent@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.1.tgz#0277e28f13a07d45c663633841e20a40aaafe0ab" - integrity sha512-Eun8zV0kcYS1g19r78osiQLEFIRspRUDd9tIfBCTBPBeMieF/EsJNL8VI3xOIdYRDEkjQnqOYPsZ2DsWsVsFwQ== +https-proxy-agent@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b" + integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA== dependencies: agent-base "^7.0.2" debug "4" @@ -1455,10 +1455,10 @@ yaml-front-matter@^4.1.1: commander "^6.2.0" js-yaml "^3.14.1" -yaml@^2.2.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.2.tgz#f522db4313c671a0ca963a75670f1c12ea909144" - integrity sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg== +yaml@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" + integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== zwitch@^1.0.0: version "1.0.5" From 2b16ea76c65ad1e17745cf4e7eb1fe5037a36e43 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Tue, 14 Nov 2023 23:27:38 +0000 Subject: [PATCH 02/10] update the setting ui --- src/ui/settingTabs.ts | 267 +++++++++++++++++++++++++++--------------- 1 file changed, 175 insertions(+), 92 deletions(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 95ca328..7a28084 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -91,38 +91,71 @@ export class ObsidianSettingTab extends PluginSettingTab { this.plugin.settings.NextButton = value; await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); + + // Clear existing components + notionAPINextEl.empty(); + databaseIDNextEl.empty(); + + if (value) { + new Setting(notionAPINextEl) + .setName(i18nConfig.NotionAPI) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionAPIText) + .setValue(this.plugin.settings.notionAPINext) + .onChange(async (value) => { + this.plugin.settings.notionAPINext = value; + await this.plugin.saveSettings(); + }) + }); + + notionAPINextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + notionAPINextEl.style.paddingTop = value ? "0.75em" : "0"; + + new Setting(databaseIDNextEl) + .setName(i18nConfig.DatabaseID) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.DatabaseIDText) + .setValue(this.plugin.settings.databaseIDNext) + .onChange(async (value) => { + this.plugin.settings.databaseIDNext = value; + await this.plugin.saveSettings(); + }) + } + ); + + databaseIDNextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + databaseIDNextEl.style.paddingTop = value ? "0.75em" : "0"; + + } else { + notionAPINextEl.style.borderTop = "none"; + notionAPINextEl.style.paddingTop = "0"; + databaseIDNextEl.style.borderTop = "none"; + databaseIDNextEl.style.paddingTop = "0"; + } }) ); - new Setting(containerEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPINext) - .onChange(async (value) => { - this.plugin.settings.notionAPINext = value; - await this.plugin.saveSettings(); - }) - }); + const notionAPINextEl = containerEl.createDiv('api-next', (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + } + ); + + const databaseIDNextEl = containerEl.createDiv('databaseID-next', (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + } + ); - const notionDatabaseID = new Setting(containerEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.DatabaseIDText) - .setValue(this.plugin.settings.databaseIDNext) - .onChange(async (value) => { - this.plugin.settings.databaseIDNext = value; - await this.plugin.saveSettings(); - }) - } - ); // notionDatabaseID.controlEl.querySelector('input').type='password' @@ -142,49 +175,112 @@ export class ObsidianSettingTab extends PluginSettingTab { this.plugin.settings.GeneralButton = value; await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); + + // Clear existing components + CustomTitleEl.empty(); + notionAPIGeneralEl.empty(); + databaseIDGeneralEl.empty(); + + if (value) { + 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; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + + // Clear existing components + dynamicSettingContainer.empty(); + + // Add new components based on the toggle value + if (this.plugin.settings.CustomTitleButton) { + new Setting(dynamicSettingContainer) + .setName(i18nConfig.NotionCustomTitleName) + .setDesc(i18nConfig.NotionCustomTitleNameDesc) + .addText((text) => + text + .setPlaceholder(i18nConfig.NotionCustomTitleText) + .setValue(this.plugin.settings.CustomTitleName) + .onChange(async (value) => { + this.plugin.settings.CustomTitleName = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + + // Clear existing components + CustomTitleEl.empty(); + }) + ); + dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; + } else { + dynamicSettingContainer.style.borderTop = "none"; + dynamicSettingContainer.style.paddingTop = "0"; + } + }) + ); + + CustomTitleEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + CustomTitleEl.style.paddingTop = value ? "0.75em" : "0"; + + new Setting(notionAPIGeneralEl) + .setName(i18nConfig.NotionAPI) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionAPIText) + .setValue(this.plugin.settings.notionAPIGeneral) + .onChange(async (value) => { + this.plugin.settings.notionAPIGeneral = value; + await this.plugin.saveSettings(); + }) + }); + + notionAPIGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + notionAPIGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + + + new Setting(databaseIDGeneralEl) + .setName(i18nConfig.DatabaseID) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionIDText) + .setValue(this.plugin.settings.databaseIDGeneral) + .onChange(async (value) => { + this.plugin.settings.databaseIDGeneral = value; + await this.plugin.saveSettings(); + }) + } + ); + + databaseIDGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + databaseIDGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + + } else { + CustomTitleEl.style.borderTop = "none"; + CustomTitleEl.style.paddingTop = "0"; + notionAPIGeneralEl.style.borderTop = "none"; + notionAPIGeneralEl.style.paddingTop = "0"; + databaseIDGeneralEl.style.borderTop = "none"; + databaseIDGeneralEl.style.paddingTop = "0"; + } }) ); - new Setting(containerEl) - .setName(i18nConfig.NotionCustomTitle) - .setDesc(i18nConfig.NotionCustomTitleDesc) - .addToggle((toggle) => - toggle - .setValue(this.plugin.settings.CustomTitleButton) - .onChange(async (value) => { - this.plugin.settings.CustomTitleButton = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - - // Clear existing components - dynamicSettingContainer.empty(); - - // Add new components based on the toggle value - if (this.plugin.settings.CustomTitleButton) { - new Setting(dynamicSettingContainer) - .setName(i18nConfig.NotionCustomTitleName) - .setDesc(i18nConfig.NotionCustomTitleNameDesc) - .addText((text) => - text - .setPlaceholder(i18nConfig.NotionCustomTitleText) - .setValue(this.plugin.settings.CustomTitleName) - .onChange(async (value) => { - this.plugin.settings.CustomTitleName = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - }) - ); - dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; - } else { - dynamicSettingContainer.style.borderTop = "none"; - dynamicSettingContainer.style.paddingTop = "0"; - } - }) - ); + const CustomTitleEl = containerEl.createDiv('api-general', (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + } + ); const dynamicSettingContainer = containerEl.createDiv('setting-popover', (div) => { - div.style.display = "flex"; div.style.alignItems = "center"; div.style.borderTop = "none"; div.style.paddingBottom = "0"; @@ -201,35 +297,22 @@ export class ObsidianSettingTab extends PluginSettingTab { // await this.plugin.saveSettings(); // }) // ); - new Setting(containerEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPIGeneral) - .onChange(async (value) => { - this.plugin.settings.notionAPIGeneral = value; - await this.plugin.saveSettings(); - }) - }); - new Setting(containerEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionIDText) - .setValue(this.plugin.settings.databaseIDGeneral) - .onChange(async (value) => { - this.plugin.settings.databaseIDGeneral = value; - await this.plugin.saveSettings(); - }) - } - ); + const notionAPIGeneralEl = containerEl.createDiv('api-general', (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + } + ); + + const databaseIDGeneralEl = containerEl.createDiv('databaseID-general', (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + } + ); + // Custom Database Settings From 671936ee416fb26758ae85fd20a183ffd24b6f90 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Wed, 15 Nov 2023 00:15:52 +0000 Subject: [PATCH 03/10] add some details for collapse --- src/ui/settingTabs.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 7a28084..40ed785 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -50,7 +50,37 @@ export class ObsidianSettingTab extends PluginSettingTab { containerEl.empty(); - containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }) + // create a collapsible container + const collapsible = containerEl.createEl('button', { + cls: 'collapsible', + text: i18nConfig.GeneralSetting, + }, (button) => { + button.style.color = "white"; + button.style.cursor = "pointer"; + button.style.padding = "18px"; + button.style.width = "100%"; + button.style.border = "none"; + button.style.textAlign = "left"; + button.style.outline = "none"; + button.style.fontSize = "15px"; + } + ); + + + + const content = containerEl.createDiv('content', (div) => { + div.style.padding = "0 18px"; + div.style.display = "none"; + div.style.overflow = "hidden"; + div.style.backgroundColor = "var(--background-primary-alt)"; + } + ); + + + collapsible.appendChild(content); + + + containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }); new Setting(containerEl) .setName(i18nConfig.BannerUrl) From 662edbb84c6b7d8d01a2b48df5a12860ed787112 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Wed, 15 Nov 2023 00:16:19 +0000 Subject: [PATCH 04/10] remove the collapse details --- src/ui/settingTabs.ts | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 40ed785..af16ac1 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -50,36 +50,7 @@ export class ObsidianSettingTab extends PluginSettingTab { containerEl.empty(); - // create a collapsible container - const collapsible = containerEl.createEl('button', { - cls: 'collapsible', - text: i18nConfig.GeneralSetting, - }, (button) => { - button.style.color = "white"; - button.style.cursor = "pointer"; - button.style.padding = "18px"; - button.style.width = "100%"; - button.style.border = "none"; - button.style.textAlign = "left"; - button.style.outline = "none"; - button.style.fontSize = "15px"; - } - ); - - - - const content = containerEl.createDiv('content', (div) => { - div.style.padding = "0 18px"; - div.style.display = "none"; - div.style.overflow = "hidden"; - div.style.backgroundColor = "var(--background-primary-alt)"; - } - ); - - - collapsible.appendChild(content); - - + // General Settings containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }); new Setting(containerEl) From 6550bca70f53d1e6bfc7dcd72b6334d0041bd339 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Wed, 15 Nov 2023 09:34:22 +0000 Subject: [PATCH 05/10] reorganise the setting coding --- src/ui/settingTabs.ts | 312 ++++++++++++++++++++---------------------- 1 file changed, 150 insertions(+), 162 deletions(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index af16ac1..7023849 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -50,7 +50,7 @@ export class ObsidianSettingTab extends PluginSettingTab { containerEl.empty(); - // General Settings + // General Settings containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }); new Setting(containerEl) @@ -93,68 +93,58 @@ export class ObsidianSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); - // Clear existing components - notionAPINextEl.empty(); - databaseIDNextEl.empty(); + // Clear existing components + notionAPINextEl.empty(); + databaseIDNextEl.empty(); - if (value) { - new Setting(notionAPINextEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPINext) - .onChange(async (value) => { - this.plugin.settings.notionAPINext = value; - await this.plugin.saveSettings(); - }) - }); + if (value) { + new Setting(notionAPINextEl) + .setName(i18nConfig.NotionAPI) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionAPIText) + .setValue(this.plugin.settings.notionAPINext) + .onChange(async (value) => { + this.plugin.settings.notionAPINext = value; + await this.plugin.saveSettings(); + }) + }); - notionAPINextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - notionAPINextEl.style.paddingTop = value ? "0.75em" : "0"; + notionAPINextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + notionAPINextEl.style.paddingTop = value ? "0.75em" : "0"; - new Setting(databaseIDNextEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.DatabaseIDText) - .setValue(this.plugin.settings.databaseIDNext) - .onChange(async (value) => { - this.plugin.settings.databaseIDNext = value; - await this.plugin.saveSettings(); - }) - } - ); + new Setting(databaseIDNextEl) + .setName(i18nConfig.DatabaseID) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.DatabaseIDText) + .setValue(this.plugin.settings.databaseIDNext) + .onChange(async (value) => { + this.plugin.settings.databaseIDNext = value; + await this.plugin.saveSettings(); + }) + } + ); - databaseIDNextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - databaseIDNextEl.style.paddingTop = value ? "0.75em" : "0"; + databaseIDNextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + databaseIDNextEl.style.paddingTop = value ? "0.75em" : "0"; - } else { - notionAPINextEl.style.borderTop = "none"; - notionAPINextEl.style.paddingTop = "0"; - databaseIDNextEl.style.borderTop = "none"; - databaseIDNextEl.style.paddingTop = "0"; - } + } else { + notionAPINextEl.style.borderTop = "none"; + notionAPINextEl.style.paddingTop = "0"; + databaseIDNextEl.style.borderTop = "none"; + databaseIDNextEl.style.paddingTop = "0"; + } }) ); - const notionAPINextEl = containerEl.createDiv('api-next', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - } - ); + const notionAPINextEl = this.createStyleDiv('api-next') - const databaseIDNextEl = containerEl.createDiv('databaseID-next', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - } - ); + const databaseIDNextEl = this.createStyleDiv('databaseID-next') @@ -177,115 +167,106 @@ export class ObsidianSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); - // Clear existing components - CustomTitleEl.empty(); - notionAPIGeneralEl.empty(); - databaseIDGeneralEl.empty(); + // Clear existing components + CustomTitleEl.empty(); + notionAPIGeneralEl.empty(); + databaseIDGeneralEl.empty(); - if (value) { - 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; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); + if (value) { + 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; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); - // Clear existing components - dynamicSettingContainer.empty(); + // Clear existing components + dynamicSettingContainer.empty(); - // Add new components based on the toggle value - if (this.plugin.settings.CustomTitleButton) { - new Setting(dynamicSettingContainer) - .setName(i18nConfig.NotionCustomTitleName) - .setDesc(i18nConfig.NotionCustomTitleNameDesc) - .addText((text) => - text - .setPlaceholder(i18nConfig.NotionCustomTitleText) - .setValue(this.plugin.settings.CustomTitleName) - .onChange(async (value) => { - this.plugin.settings.CustomTitleName = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); + // Add new components based on the toggle value + if (this.plugin.settings.CustomTitleButton) { + new Setting(dynamicSettingContainer) + .setName(i18nConfig.NotionCustomTitleName) + .setDesc(i18nConfig.NotionCustomTitleNameDesc) + .addText((text) => + text + .setPlaceholder(i18nConfig.NotionCustomTitleText) + .setValue(this.plugin.settings.CustomTitleName) + .onChange(async (value) => { + this.plugin.settings.CustomTitleName = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); - // Clear existing components - CustomTitleEl.empty(); - }) - ); - dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; - } else { - dynamicSettingContainer.style.borderTop = "none"; - dynamicSettingContainer.style.paddingTop = "0"; - } - }) - ); + // Clear existing components + CustomTitleEl.empty(); + }) + ); + dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; + } else { + dynamicSettingContainer.style.borderTop = "none"; + dynamicSettingContainer.style.paddingTop = "0"; + } + }) + ); - CustomTitleEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - CustomTitleEl.style.paddingTop = value ? "0.75em" : "0"; + CustomTitleEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + CustomTitleEl.style.paddingTop = value ? "0.75em" : "0"; - new Setting(notionAPIGeneralEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPIGeneral) - .onChange(async (value) => { - this.plugin.settings.notionAPIGeneral = value; - await this.plugin.saveSettings(); - }) - }); + new Setting(notionAPIGeneralEl) + .setName(i18nConfig.NotionAPI) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionAPIText) + .setValue(this.plugin.settings.notionAPIGeneral) + .onChange(async (value) => { + this.plugin.settings.notionAPIGeneral = value; + await this.plugin.saveSettings(); + }) + }); - notionAPIGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - notionAPIGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + notionAPIGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + notionAPIGeneralEl.style.paddingTop = value ? "0.75em" : "0"; - new Setting(databaseIDGeneralEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionIDText) - .setValue(this.plugin.settings.databaseIDGeneral) - .onChange(async (value) => { - this.plugin.settings.databaseIDGeneral = value; - await this.plugin.saveSettings(); - }) - } - ); + new Setting(databaseIDGeneralEl) + .setName(i18nConfig.DatabaseID) + .setDesc(i18nConfig.NotionAPIDesc) + .addText((text) => { + text.inputEl.type = 'password'; + return text + .setPlaceholder(i18nConfig.NotionIDText) + .setValue(this.plugin.settings.databaseIDGeneral) + .onChange(async (value) => { + this.plugin.settings.databaseIDGeneral = value; + await this.plugin.saveSettings(); + }) + } + ); - databaseIDGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - databaseIDGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + databaseIDGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + databaseIDGeneralEl.style.paddingTop = value ? "0.75em" : "0"; - } else { - CustomTitleEl.style.borderTop = "none"; - CustomTitleEl.style.paddingTop = "0"; - notionAPIGeneralEl.style.borderTop = "none"; - notionAPIGeneralEl.style.paddingTop = "0"; - databaseIDGeneralEl.style.borderTop = "none"; - databaseIDGeneralEl.style.paddingTop = "0"; - } + } else { + CustomTitleEl.style.borderTop = "none"; + CustomTitleEl.style.paddingTop = "0"; + notionAPIGeneralEl.style.borderTop = "none"; + notionAPIGeneralEl.style.paddingTop = "0"; + databaseIDGeneralEl.style.borderTop = "none"; + databaseIDGeneralEl.style.paddingTop = "0"; + } }) ); - const CustomTitleEl = containerEl.createDiv('api-general', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - } - ); + const CustomTitleEl = this.createStyleDiv('custom-title'); - const dynamicSettingContainer = containerEl.createDiv('setting-popover', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - }); + const dynamicSettingContainer = this.createStyleDiv('dynamic-setting'); // new Setting(containerEl) // .setName("Convert tags(optional)") @@ -299,21 +280,9 @@ export class ObsidianSettingTab extends PluginSettingTab { // }) // ); + const notionAPIGeneralEl = this.createStyleDiv('api-general'); - const notionAPIGeneralEl = containerEl.createDiv('api-general', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - } - ); - - const databaseIDGeneralEl = containerEl.createDiv('databaseID-general', (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - } - ); - + const databaseIDGeneralEl = this.createStyleDiv('databaseID-general'); // Custom Database Settings @@ -331,4 +300,23 @@ export class ObsidianSettingTab extends PluginSettingTab { // }) // ); } + + // create a function to create a div with a style for pop over elements + private createStyleDiv(className: string | DomElementInfo) { + return this.containerEl.createDiv(className, (div) => { + div.style.alignItems = "center"; + div.style.borderTop = "none"; + div.style.paddingBottom = "0"; + }); + } + + // function to add one setting element in the setting tab. + private createSettingEl() { + + } + + // update the setting display style in the setting tab + private updateSettingEl() { + + } } From 4e3c88f12993239d84cc952f955ecf736d978107 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Wed, 15 Nov 2023 12:25:30 +0000 Subject: [PATCH 06/10] reorganise the code for add new setting container --- src/ui/settingTabs.ts | 95 ++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 32 deletions(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 7023849..6a7b2f1 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -112,8 +112,7 @@ export class ObsidianSettingTab extends PluginSettingTab { }) }); - notionAPINextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - notionAPINextEl.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(notionAPINextEl, value); new Setting(databaseIDNextEl) .setName(i18nConfig.DatabaseID) @@ -130,14 +129,11 @@ export class ObsidianSettingTab extends PluginSettingTab { } ); - databaseIDNextEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - databaseIDNextEl.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(databaseIDNextEl, value) } else { - notionAPINextEl.style.borderTop = "none"; - notionAPINextEl.style.paddingTop = "0"; - databaseIDNextEl.style.borderTop = "none"; - databaseIDNextEl.style.paddingTop = "0"; + this.updateSettingEl(notionAPINextEl, false) + this.updateSettingEl(databaseIDNextEl, false); } }) ); @@ -185,11 +181,11 @@ export class ObsidianSettingTab extends PluginSettingTab { await this.plugin.commands.updateCommand(); // Clear existing components - dynamicSettingContainer.empty(); + CustomNameEl.empty(); // Add new components based on the toggle value if (this.plugin.settings.CustomTitleButton) { - new Setting(dynamicSettingContainer) + new Setting(CustomNameEl) .setName(i18nConfig.NotionCustomTitleName) .setDesc(i18nConfig.NotionCustomTitleNameDesc) .addText((text) => @@ -205,17 +201,14 @@ export class ObsidianSettingTab extends PluginSettingTab { CustomTitleEl.empty(); }) ); - dynamicSettingContainer.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - dynamicSettingContainer.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(CustomNameEl, value) } else { - dynamicSettingContainer.style.borderTop = "none"; - dynamicSettingContainer.style.paddingTop = "0"; - } + this.updateSettingEl(CustomNameEl, false); + } }) ); - CustomTitleEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - CustomTitleEl.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(CustomTitleEl, value); new Setting(notionAPIGeneralEl) .setName(i18nConfig.NotionAPI) @@ -231,8 +224,7 @@ export class ObsidianSettingTab extends PluginSettingTab { }) }); - notionAPIGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - notionAPIGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(notionAPIGeneralEl, value); new Setting(databaseIDGeneralEl) @@ -250,23 +242,19 @@ export class ObsidianSettingTab extends PluginSettingTab { } ); - databaseIDGeneralEl.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - databaseIDGeneralEl.style.paddingTop = value ? "0.75em" : "0"; + this.updateSettingEl(databaseIDGeneralEl, value); } else { - CustomTitleEl.style.borderTop = "none"; - CustomTitleEl.style.paddingTop = "0"; - notionAPIGeneralEl.style.borderTop = "none"; - notionAPIGeneralEl.style.paddingTop = "0"; - databaseIDGeneralEl.style.borderTop = "none"; - databaseIDGeneralEl.style.paddingTop = "0"; + this.updateSettingEl(CustomTitleEl, false); + this.updateSettingEl(notionAPIGeneralEl, false); + this.updateSettingEl(databaseIDGeneralEl, false); } }) ); const CustomTitleEl = this.createStyleDiv('custom-title'); - const dynamicSettingContainer = this.createStyleDiv('dynamic-setting'); + const CustomNameEl = this.createStyleDiv('custom-name'); // new Setting(containerEl) // .setName("Convert tags(optional)") @@ -311,12 +299,55 @@ export class ObsidianSettingTab extends PluginSettingTab { } // function to add one setting element in the setting tab. - private createSettingEl() { - + private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type:string, placeholder: string, setvalue: any) { + if (type === 'password') { + return new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addText((text) => { + text.inputEl.type = type; + return text + .setPlaceholder(placeholder) + .setValue(setvalue) + .onChange(async (value) => { + setvalue = value; + await this.plugin.saveSettings(); + }) + } + ) + } else if (type === 'toggle') { + return new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addToggle((toggle) => + toggle + .setValue(setvalue) + .onChange(async (value) => { + setvalue = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ) + } else if (type === 'text') { + new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addText((text) => + text + .setPlaceholder(placeholder) + .setValue(setvalue) + .onChange(async (value) => { + setvalue = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ) + } } // update the setting display style in the setting tab - private updateSettingEl() { - + private updateSettingEl(element: HTMLElement, value: boolean) { + element.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; + element.style.paddingTop = value ? "0.75em" : "0"; } } From b978cf7e01e09f528f673bfb81798f41fc7b74cd Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Thu, 16 Nov 2023 00:02:35 +0000 Subject: [PATCH 07/10] complete the setting ui --- src/ui/settingTabs.ts | 308 ++++++------------ .../upload_general/Upload2NotionGeneral.ts | 2 +- 2 files changed, 94 insertions(+), 216 deletions(-) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 6a7b2f1..8be0ad7 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -53,35 +53,13 @@ export class ObsidianSettingTab extends PluginSettingTab { // General Settings containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }); - new Setting(containerEl) - .setName(i18nConfig.BannerUrl) - .setDesc(i18nConfig.BannerUrlDesc) - .addText((text) => - text - .setPlaceholder(i18nConfig.BannerUrlText) - .setValue(this.plugin.settings.bannerUrl) - .onChange(async (value) => { - this.plugin.settings.bannerUrl = value; - await this.plugin.saveSettings(); - }) - ); + this.createSettingEl(containerEl, i18nConfig.BannerUrl, i18nConfig.BannerUrlDesc, 'text', i18nConfig.BannerUrlText, this.plugin.settings.bannerUrl) - - new Setting(containerEl) - .setName(i18nConfig.NotionUser) - .setDesc(i18nConfig.NotionUserDesc) - .addText((text) => - text - .setPlaceholder(i18nConfig.NotionUserText) - .setValue(this.plugin.settings.notionUser) - .onChange(async (value) => { - this.plugin.settings.notionUser = value; - await this.plugin.saveSettings(); - }) - ); + this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser) containerEl.createEl('h2', { text: i18nConfig.NotionNextSettingHeader }) + new Setting(containerEl) .setName(i18nConfig.NotionNextButton) .setDesc(i18nConfig.NotionNextButtonDesc) @@ -90,61 +68,22 @@ export class ObsidianSettingTab extends PluginSettingTab { .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(); - - // Clear existing components - notionAPINextEl.empty(); - databaseIDNextEl.empty(); - - if (value) { - new Setting(notionAPINextEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPINext) - .onChange(async (value) => { - this.plugin.settings.notionAPINext = value; - await this.plugin.saveSettings(); - }) - }); - - this.updateSettingEl(notionAPINextEl, value); - - new Setting(databaseIDNextEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.DatabaseIDText) - .setValue(this.plugin.settings.databaseIDNext) - .onChange(async (value) => { - this.plugin.settings.databaseIDNext = value; - await this.plugin.saveSettings(); - }) - } - ); - - this.updateSettingEl(databaseIDNextEl, value) - - } else { - this.updateSettingEl(notionAPINextEl, false) - this.updateSettingEl(databaseIDNextEl, false); - } }) ); - const notionAPINextEl = this.createStyleDiv('api-next') - const databaseIDNextEl = this.createStyleDiv('databaseID-next') + const notionAPINextEl = this.createStyleDiv('api-next', this.plugin.settings.NextButton) + this.createSettingEl(notionAPINextEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPINext) - - - // notionDatabaseID.controlEl.querySelector('input').type='password' + const databaseIDNextEl = this.createStyleDiv('databaseID-next', this.plugin.settings.NextButton) + this.createSettingEl(databaseIDNextEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDNext) // General Database Settings @@ -160,101 +99,37 @@ export class ObsidianSettingTab extends PluginSettingTab { .setValue(this.plugin.settings.GeneralButton) .onChange(async (value) => { this.plugin.settings.GeneralButton = value; + + this.updateSettingEl(CustomTitleEl, value) + this.updateSettingEl(notionAPIGeneralEl, value) + this.updateSettingEl(databaseIDGeneralEl, value) + + await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); - // Clear existing components - CustomTitleEl.empty(); - notionAPIGeneralEl.empty(); - databaseIDGeneralEl.empty(); - - if (value) { - 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; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - - // Clear existing components - CustomNameEl.empty(); - - // Add new components based on the toggle value - if (this.plugin.settings.CustomTitleButton) { - new Setting(CustomNameEl) - .setName(i18nConfig.NotionCustomTitleName) - .setDesc(i18nConfig.NotionCustomTitleNameDesc) - .addText((text) => - text - .setPlaceholder(i18nConfig.NotionCustomTitleText) - .setValue(this.plugin.settings.CustomTitleName) - .onChange(async (value) => { - this.plugin.settings.CustomTitleName = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - - // Clear existing components - CustomTitleEl.empty(); - }) - ); - this.updateSettingEl(CustomNameEl, value) - } else { - this.updateSettingEl(CustomNameEl, false); - } - }) - ); - - this.updateSettingEl(CustomTitleEl, value); - - new Setting(notionAPIGeneralEl) - .setName(i18nConfig.NotionAPI) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionAPIText) - .setValue(this.plugin.settings.notionAPIGeneral) - .onChange(async (value) => { - this.plugin.settings.notionAPIGeneral = value; - await this.plugin.saveSettings(); - }) - }); - - this.updateSettingEl(notionAPIGeneralEl, value); - - - new Setting(databaseIDGeneralEl) - .setName(i18nConfig.DatabaseID) - .setDesc(i18nConfig.NotionAPIDesc) - .addText((text) => { - text.inputEl.type = 'password'; - return text - .setPlaceholder(i18nConfig.NotionIDText) - .setValue(this.plugin.settings.databaseIDGeneral) - .onChange(async (value) => { - this.plugin.settings.databaseIDGeneral = value; - await this.plugin.saveSettings(); - }) - } - ); - - this.updateSettingEl(databaseIDGeneralEl, value); - - } else { - this.updateSettingEl(CustomTitleEl, false); - this.updateSettingEl(notionAPIGeneralEl, false); - this.updateSettingEl(databaseIDGeneralEl, false); - } }) ); - const CustomTitleEl = this.createStyleDiv('custom-title'); + 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; - const CustomNameEl = this.createStyleDiv('custom-name'); + this.updateSettingEl(CustomNameEl, value) + + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ); + + const CustomNameEl = this.createStyleDiv('custom-name', this.plugin.settings.CustomTitleButton); + this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName) // new Setting(containerEl) // .setName("Convert tags(optional)") @@ -268,9 +143,12 @@ export class ObsidianSettingTab extends PluginSettingTab { // }) // ); - const notionAPIGeneralEl = this.createStyleDiv('api-general'); + const notionAPIGeneralEl = this.createStyleDiv('api-general', this.plugin.settings.GeneralButton); + this.createSettingEl(notionAPIGeneralEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPIGeneral) - const databaseIDGeneralEl = this.createStyleDiv('databaseID-general'); + + const databaseIDGeneralEl = this.createStyleDiv('databaseID-general', this.plugin.settings.GeneralButton); + this.createSettingEl(databaseIDGeneralEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDGeneral) // Custom Database Settings @@ -289,65 +167,65 @@ export class ObsidianSettingTab extends PluginSettingTab { // ); } - // create a function to create a div with a style for pop over elements - private createStyleDiv(className: string | DomElementInfo) { + // create a function to create a div with a style for pop over elements + private createStyleDiv(className: string, commandValue: boolean = false) { return this.containerEl.createDiv(className, (div) => { - div.style.alignItems = "center"; - div.style.borderTop = "none"; - div.style.paddingBottom = "0"; - }); + this.updateSettingEl(div, commandValue); + }); + } + // update the setting display style in the setting tab + private updateSettingEl(element: HTMLElement, commandValue: boolean) { + element.style.borderTop = commandValue ? "1px solid var(--background-modifier-border)" : "none"; + element.style.paddingTop = commandValue ? "0.75em" : "0"; + element.style.display = commandValue? "block" : "none"; + element.style.alignItems = "center"; } - // function to add one setting element in the setting tab. - private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type:string, placeholder: string, setvalue: any) { - if (type === 'password') { - return new Setting(containerEl) - .setName(name) - .setDesc(desc) - .addText((text) => { - text.inputEl.type = type; - return text - .setPlaceholder(placeholder) - .setValue(setvalue) - .onChange(async (value) => { - setvalue = value; - await this.plugin.saveSettings(); + // function to add one setting element in the setting tab. + private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any) { + if (type === 'password') { + return new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addText((text) => { + text.inputEl.type = type; + return text + .setPlaceholder(placeholder) + .setValue(holderValue) + .onChange(async (value) => { + holderValue = value; + await this.plugin.saveSettings(); }) } - ) + ) } else if (type === 'toggle') { - return new Setting(containerEl) - .setName(name) - .setDesc(desc) - .addToggle((toggle) => - toggle - .setValue(setvalue) - .onChange(async (value) => { - setvalue = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); - }) - ) - } else if (type === 'text') { - new Setting(containerEl) - .setName(name) - .setDesc(desc) - .addText((text) => - text - .setPlaceholder(placeholder) - .setValue(setvalue) - .onChange(async (value) => { - setvalue = value; - await this.plugin.saveSettings(); - await this.plugin.commands.updateCommand(); + return new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addToggle((toggle) => + toggle + .setValue(holderValue) + .onChange(async (value) => { + holderValue = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); }) - ) + ) + } else if (type === 'text') { + new Setting(containerEl) + .setName(name) + .setDesc(desc) + .addText((text) => + text + .setPlaceholder(placeholder) + .setValue(holderValue) + .onChange(async (value) => { + holderValue = value; + await this.plugin.saveSettings(); + await this.plugin.commands.updateCommand(); + }) + ) } - } - - // update the setting display style in the setting tab - private updateSettingEl(element: HTMLElement, value: boolean) { - element.style.borderTop = value ? "1px solid var(--background-modifier-border)" : "none"; - element.style.paddingTop = value ? "0.75em" : "0"; } + } diff --git a/src/upload/upload_general/Upload2NotionGeneral.ts b/src/upload/upload_general/Upload2NotionGeneral.ts index a73bfb1..dcc5555 100644 --- a/src/upload/upload_general/Upload2NotionGeneral.ts +++ b/src/upload/upload_general/Upload2NotionGeneral.ts @@ -43,7 +43,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral { title: string, cover: string, tags: string[], - childArr: any + childArr: any, ) { const bodyString: any = { parent: { From 6ce689ba96556955e3e3d7160b2742658c8fe548 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Thu, 16 Nov 2023 01:00:52 +0000 Subject: [PATCH 08/10] complete the basic customisation feature --- src/commands/FuzzySuggester.ts | 4 +- src/commands/NotionCommands.ts | 36 +++++++-------- src/lang/I18n.ts | 44 +++++++++---------- src/main.ts | 10 ++--- src/ui/settingTabs.ts | 34 +++++++------- src/upload/updateYaml.ts | 6 +-- src/upload/uploadCommand.ts | 26 +++++------ .../upload_general/Upload2NotionGeneral.ts | 12 ++--- 8 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/commands/FuzzySuggester.ts b/src/commands/FuzzySuggester.ts index 0c912da..34d2de0 100644 --- a/src/commands/FuzzySuggester.ts +++ b/src/commands/FuzzySuggester.ts @@ -1,6 +1,6 @@ import { FuzzySuggestModal, FuzzyMatch } from 'obsidian'; import MyPlugin from "../main"; -import {i18nConfig} from "../lang/I18n"; +import { i18nConfig } from "../lang/I18n"; /** * Simple interface for what should be displayed and stored for suggester @@ -38,7 +38,7 @@ export class FuzzySuggester extends FuzzySuggestModal{ return item.name } - onChooseItem(item: DatabaseList, evt:MouseEvent | KeyboardEvent): void { } + onChooseItem(item: DatabaseList, evt: MouseEvent | KeyboardEvent): void { } onChooseSuggestion(item: FuzzyMatch, evt: MouseEvent | KeyboardEvent): void { this.callback(item.item, evt) diff --git a/src/commands/NotionCommands.ts b/src/commands/NotionCommands.ts index dcfb90b..2ca4b2b 100644 --- a/src/commands/NotionCommands.ts +++ b/src/commands/NotionCommands.ts @@ -1,7 +1,7 @@ -import {i18nConfig} from "src/lang/I18n"; -import {Editor, MarkdownView} from "obsidian"; -import {FuzzySuggester, DatabaseList} from "./FuzzySuggester"; -import {uploadCommandGeneral, uploadCommandNext} from "../upload/uploadCommand"; +import { i18nConfig } from "src/lang/I18n"; +import { Editor, MarkdownView } from "obsidian"; +import { FuzzySuggester, DatabaseList } from "./FuzzySuggester"; +import { uploadCommandGeneral, uploadCommandNext } from "../upload/uploadCommand"; import ObsidianSyncNotionPlugin from "src/main"; @@ -14,7 +14,7 @@ interface Command { // create the commands list export default class RibbonCommands { - plugin: ObsidianSyncNotionPlugin; + plugin: ObsidianSyncNotionPlugin; Ncommand: Command[] = []; @@ -55,22 +55,22 @@ export default class RibbonCommands { }); } - async ribbonDisplay() { - const NcommandList: DatabaseList[] = []; + async ribbonDisplay() { + const NcommandList: DatabaseList[] = []; - this.Ncommand.map(command => NcommandList.push( - { - name:command.name, - match: command.editorCallback - } - ) - ); + this.Ncommand.map(command => NcommandList.push( + { + name: command.name, + match: command.editorCallback + } + ) + ); - const fusg = new FuzzySuggester(this.plugin); + const fusg = new FuzzySuggester(this.plugin); - fusg.setSuggesterData(NcommandList); - await fusg.display(async (results) => {await results.match()}) - }; + fusg.setSuggesterData(NcommandList); + await fusg.display(async (results) => { await results.match() }) + }; // if the setting has been changed, try to rebuild the command list async updateCommand() { diff --git a/src/lang/I18n.ts b/src/lang/I18n.ts index e5fe195..46973b0 100644 --- a/src/lang/I18n.ts +++ b/src/lang/I18n.ts @@ -24,13 +24,13 @@ export const I18n: { [key: string]: any } = { NotionUserText: "Enter your notion ID", NotionGeneralSettingHeader: "General Notion Database Settings", NotionGeneralButton: "Notion General command switch", - NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette", - NotionCustomTitle: "Customise column name", - NotionCustomTitleDesc: "Modify the column name of the Notion database, default (off)", - NotionCustomTitleName: "Preferred title name", - NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database", - NotionCustomTitleText: "Enter the name", - NotYetFinish: + NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette", + NotionCustomTitle: "Customise column name", + NotionCustomTitleDesc: "Modify the column name of the Notion database, default (off)", + NotionCustomTitleName: "Preferred title name", + NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database", + NotionCustomTitleText: "Enter the name", + NotYetFinish: "Not finished. This function will be available in the next version", PlaceHolder: "Enter database Name", "notion-logo": "Share to NotionNext", @@ -47,9 +47,9 @@ export const I18n: { [key: string]: any } = { "The 'NNon' property is missing in the settings. Please set it up.", "set-api-id": "Please set up the notion API and database ID in the settings tab.", - NotionCustomSettingHeader: "Notion Custom Database Settings", - NotionCustomButton: "Notion Customised command switch", - NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette", + NotionCustomSettingHeader: "Notion Custom Database Settings", + NotionCustomButton: "Notion Customised command switch", + NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette", }, zh: { ribbonIcon: "分享到 NotionNext", @@ -58,8 +58,8 @@ export const I18n: { [key: string]: any } = { CommandName: "分享到 NotionNext", CommandIDGeneral: "share-to-notion", CommandNameGeneral: "分享到 Notion 普通数据库", - NotionNextButton: "NotionNext 同步命令开关", - NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中", + NotionNextButton: "NotionNext 同步命令开关", + NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中", NotionNextSettingHeader: "NotionNext 数据库参数设置", NotionAPI: "Notion API 令牌", NotionAPIDesc: "显示为密码", @@ -75,14 +75,14 @@ export const I18n: { [key: string]: any } = { "你的 Notion ID(可选),分享链接类似:https://username.notion.site/,你的 Notion ID 是 [username]", NotionUserText: "输入你的 Notion ID", NotionGeneralSettingHeader: "普通 Notion 数据库设置", - NotionGeneralButton: "普通数据库同步命令开关", - NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中", + NotionGeneralButton: "普通数据库同步命令开关", + NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中", NotionCustomTitle: "修改 Notion 数据库表头开关", - NotionCustomTitleDesc: "自定义Notion 数据库第一列表头,默认关闭", - NotionCustomTitleName: "想要修改的表头名", - NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名", - NotionCustomTitleText: "输入表头名", - NotYetFinish: "未完成。此功能将在之后版本中提供", + NotionCustomTitleDesc: "自定义Notion 数据库第一列表头,默认关闭", + NotionCustomTitleName: "想要修改的表头名", + NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名", + NotionCustomTitleText: "输入表头名", + NotYetFinish: "未完成。此功能将在之后版本中提供", PlaceHolder: "输入数据库名称", "notion-logo": "分享到NotionNext", "sync-success": "同步到NotionNext成功:\n", @@ -94,9 +94,9 @@ export const I18n: { [key: string]: any } = { "设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关", NNonMissing: "未设置'NNon'属性,请在插件设置中选择NotionNext数据库。", "set-api-id": "请在插件设置中设置notion API和database ID", - NotionCustomSettingHeader: "Notion 自定义数据库设置", - NotionCustomButton: "Notion 自定义数据库同步命令开关", - NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中", + NotionCustomSettingHeader: "Notion 自定义数据库设置", + NotionCustomButton: "Notion 自定义数据库同步命令开关", + NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中", }, }; diff --git a/src/main.ts b/src/main.ts index 6910774..5352417 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,8 @@ -import {App, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting} from "obsidian"; -import {addIcons} from 'src/ui/icon'; -import {Upload2NotionGeneral} from "src/upload/upload_general/Upload2NotionGeneral"; -import {Upload2NotionNext} from "src/upload/upload_next/Upload2NotionNext"; -import {i18nConfig} from "src/lang/I18n"; +import { App, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting } from "obsidian"; +import { addIcons } from 'src/ui/icon'; +import { Upload2NotionGeneral } from "src/upload/upload_general/Upload2NotionGeneral"; +import { Upload2NotionNext } from "src/upload/upload_next/Upload2NotionNext"; +import { i18nConfig } from "src/lang/I18n"; import ribbonCommands from "src/commands/NotionCommands"; import { ObsidianSettingTab, PluginSettings, DEFAULT_SETTINGS } from "src/ui/settingTabs"; diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 8be0ad7..e8782f0 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -17,6 +17,7 @@ export interface PluginSettings { CustomButton: boolean; notionAPICustom: string; databaseIDCustom: string; + [key: string]: any; } export const DEFAULT_SETTINGS: PluginSettings = { @@ -53,9 +54,9 @@ export class ObsidianSettingTab extends PluginSettingTab { // General Settings containerEl.createEl('h2', { text: i18nConfig.GeneralSetting }); - this.createSettingEl(containerEl, i18nConfig.BannerUrl, i18nConfig.BannerUrlDesc, 'text', i18nConfig.BannerUrlText, this.plugin.settings.bannerUrl) + this.createSettingEl(containerEl, i18nConfig.BannerUrl, i18nConfig.BannerUrlDesc, 'text', i18nConfig.BannerUrlText, this.plugin.settings.bannerUrl, 'bannerUrl') - this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser) + this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser') containerEl.createEl('h2', { text: i18nConfig.NotionNextSettingHeader }) @@ -80,10 +81,10 @@ export class ObsidianSettingTab extends PluginSettingTab { const notionAPINextEl = this.createStyleDiv('api-next', this.plugin.settings.NextButton) - this.createSettingEl(notionAPINextEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPINext) + 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) + this.createSettingEl(databaseIDNextEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDNext, 'databaseIDNext') // General Database Settings @@ -129,7 +130,7 @@ export class ObsidianSettingTab extends PluginSettingTab { ); const CustomNameEl = this.createStyleDiv('custom-name', this.plugin.settings.CustomTitleButton); - this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName) + this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName, 'CustomTitleName') // new Setting(containerEl) // .setName("Convert tags(optional)") @@ -144,11 +145,11 @@ export class ObsidianSettingTab extends PluginSettingTab { // ); const notionAPIGeneralEl = this.createStyleDiv('api-general', this.plugin.settings.GeneralButton); - this.createSettingEl(notionAPIGeneralEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPIGeneral) + 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) + this.createSettingEl(databaseIDGeneralEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDGeneral, 'databaseIDGeneral') // Custom Database Settings @@ -177,12 +178,12 @@ export class ObsidianSettingTab extends PluginSettingTab { private updateSettingEl(element: HTMLElement, commandValue: boolean) { element.style.borderTop = commandValue ? "1px solid var(--background-modifier-border)" : "none"; element.style.paddingTop = commandValue ? "0.75em" : "0"; - element.style.display = commandValue? "block" : "none"; + element.style.display = commandValue ? "block" : "none"; element.style.alignItems = "center"; } // function to add one setting element in the setting tab. - private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any) { + private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any, settingsKey: string) { if (type === 'password') { return new Setting(containerEl) .setName(name) @@ -193,11 +194,10 @@ export class ObsidianSettingTab extends PluginSettingTab { .setPlaceholder(placeholder) .setValue(holderValue) .onChange(async (value) => { - holderValue = value; + this.plugin.settings[settingsKey] = value; // Update the plugin settings directly await this.plugin.saveSettings(); }) - } - ) + }); } else if (type === 'toggle') { return new Setting(containerEl) .setName(name) @@ -206,13 +206,13 @@ export class ObsidianSettingTab extends PluginSettingTab { toggle .setValue(holderValue) .onChange(async (value) => { - holderValue = value; + this.plugin.settings[settingsKey] = value; // Update the plugin settings directly await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); }) - ) + ); } else if (type === 'text') { - new Setting(containerEl) + return new Setting(containerEl) .setName(name) .setDesc(desc) .addText((text) => @@ -220,11 +220,11 @@ export class ObsidianSettingTab extends PluginSettingTab { .setPlaceholder(placeholder) .setValue(holderValue) .onChange(async (value) => { - holderValue = value; + this.plugin.settings[settingsKey] = value; // Update the plugin settings directly await this.plugin.saveSettings(); await this.plugin.commands.updateCommand(); }) - ) + ); } } diff --git a/src/upload/updateYaml.ts b/src/upload/updateYaml.ts index a55e21e..5e90a85 100644 --- a/src/upload/updateYaml.ts +++ b/src/upload/updateYaml.ts @@ -1,6 +1,6 @@ -import {App, Notice, TFile} from "obsidian"; +import { App, Notice, TFile } from "obsidian"; import ObsidianSyncNotionPlugin from "../main"; -import {PluginSettings} from "../ui/settingTabs"; +import { PluginSettings } from "../ui/settingTabs"; export async function updateYamlInfo( yamlContent: string, @@ -9,7 +9,7 @@ export async function updateYamlInfo( app: App, plugin: ObsidianSyncNotionPlugin, ) { - let {url, id} = res.json + let { url, id } = res.json // replace www to notionID const { notionUser } = plugin.settings; diff --git a/src/upload/uploadCommand.ts b/src/upload/uploadCommand.ts index 158399e..fbd2c78 100644 --- a/src/upload/uploadCommand.ts +++ b/src/upload/uploadCommand.ts @@ -1,11 +1,11 @@ -import {i18nConfig} from "../lang/I18n"; -import {App, Notice} from "obsidian"; -import {Upload2NotionNext} from "./upload_next/Upload2NotionNext"; -import {Upload2NotionGeneral} from "./upload_general/Upload2NotionGeneral"; -import {PluginSettings} from "../ui/settingTabs"; +import { i18nConfig } from "../lang/I18n"; +import { App, Notice } from "obsidian"; +import { Upload2NotionNext } from "./upload_next/Upload2NotionNext"; +import { Upload2NotionGeneral } from "./upload_general/Upload2NotionGeneral"; +import { PluginSettings } from "../ui/settingTabs"; import ObsidianSyncNotionPlugin from "../main"; -import {getNowFileMarkdownContentNext} from "./upload_next/getMarkdownNext"; -import {getNowFileMarkdownContentGeneral} from "./upload_general/getMarkdownGeneral"; +import { getNowFileMarkdownContentNext } from "./upload_next/getMarkdownNext"; +import { getNowFileMarkdownContentGeneral } from "./upload_general/getMarkdownGeneral"; export async function uploadCommandNext( plugin: ObsidianSyncNotionPlugin, @@ -13,7 +13,7 @@ export async function uploadCommandNext( app: App, ) { - const {notionAPINext, databaseIDNext} = settings; + const { notionAPINext, databaseIDNext } = settings; // Check if NNon exists // if (NNon === undefined) { @@ -29,10 +29,10 @@ export async function uploadCommandNext( return; } - const {markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime} = await getNowFileMarkdownContentNext(app, settings) + const { markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime } = await getNowFileMarkdownContentNext(app, settings) if (markDownData) { - const {basename} = nowFile; + const { basename } = nowFile; const upload = new Upload2NotionNext(plugin); const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app); @@ -53,7 +53,7 @@ export async function uploadCommandGeneral( app: App, ) { - const{ notionAPIGeneral, databaseIDGeneral} = settings; + const { notionAPIGeneral, databaseIDGeneral } = settings; // Check if the user has set up the Notion API and database ID if (notionAPIGeneral === "" || databaseIDGeneral === "") { @@ -62,10 +62,10 @@ export async function uploadCommandGeneral( return; } - const {markDownData, nowFile,cover, tags} = await getNowFileMarkdownContentGeneral(app, settings) + const { markDownData, nowFile, cover, tags } = await getNowFileMarkdownContentGeneral(app, settings) if (markDownData) { - const {basename} = nowFile; + const { basename } = nowFile; const upload = new Upload2NotionGeneral(plugin); const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app); diff --git a/src/upload/upload_general/Upload2NotionGeneral.ts b/src/upload/upload_general/Upload2NotionGeneral.ts index dcc5555..427e3c3 100644 --- a/src/upload/upload_general/Upload2NotionGeneral.ts +++ b/src/upload/upload_general/Upload2NotionGeneral.ts @@ -4,15 +4,15 @@ import { markdownToBlocks, } from "@tryfabric/martian"; import * as yamlFrontMatter from "yaml-front-matter"; // import * as yaml from "yaml" import MyPlugin from "src/main"; -import {PluginSettings} from "../../ui/settingTabs"; -import {UploadBaseGeneral} from "./BaseUpload2NotionGeneral"; -import {updateYamlInfo} from "../updateYaml"; +import { PluginSettings } from "../../ui/settingTabs"; +import { UploadBaseGeneral } from "./BaseUpload2NotionGeneral"; +import { updateYamlInfo } from "../updateYaml"; export class Upload2NotionGeneral extends UploadBaseGeneral { settings: PluginSettings; constructor(plugin: MyPlugin) { - super(plugin); + super(plugin); } // 因为需要解析notion的block进行对比,非常的麻烦, @@ -22,7 +22,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral { title: string, cover: string, tags: string[], - childArr: any + childArr: any, ) { await this.deletePage(notionID) @@ -50,7 +50,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral { database_id: this.plugin.settings.databaseIDGeneral, }, properties: { - title: { + [this.plugin.settings.CustomTitleButton ? this.plugin.settings.CustomTitleName : 'title']: { title: [ { text: { From e7fa597e5abcd54a65afd619e51a7388ae51f30b Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Thu, 16 Nov 2023 11:14:19 +0000 Subject: [PATCH 09/10] update translate --- src/lang/I18n.ts | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/lang/I18n.ts b/src/lang/I18n.ts index 46973b0..cd2ef11 100644 --- a/src/lang/I18n.ts +++ b/src/lang/I18n.ts @@ -6,29 +6,29 @@ export const I18n: { [key: string]: any } = { CommandName: "Share to NotionNext Database", CommandIDGeneral: "share-to-notion", CommandNameGeneral: "Share to Notion General Database", - NotionNextButton: "NotionNext command switch", - NotionNextButtonDesc: "Open this option, Sync to NotionNext command will be displayed in the command palette", + NotionNextButton: "NotionNext Sync", + NotionNextButtonDesc: "Open this option, Sync to NotionNext command will be displayed in the command palette (default: ON)", NotionNextSettingHeader: "NotionNext Database Settings", NotionAPI: "Notion API Token", - NotionAPIDesc: "It's a secret", + NotionAPIDesc: "Generate from https://www.notion.so/my-integrations", NotionAPIText: "Enter your Notion API Token", DatabaseID: "Database ID", DatabaseIDText: "Enter your Database ID", - BannerUrl: "Banner url(optional)", + BannerUrl: "Banner url (optional)", BannerUrlDesc: - "Default is empty, if you want to show a banner, please enter the url(like: https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)", + "Default is empty, if you want to show a banner, please enter the url (like: https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)", BannerUrlText: "Enter your banner url", - NotionUser: "Notion ID(username, optional)", + NotionUser: "Notion ID (username, optional)", NotionUserDesc: - "Your notion ID (optional),share link likes:https://username.notion.site/,your notion id is [username]", + "Collect from share link likes:https://username.notion.site. Your notion id is [username]", NotionUserText: "Enter your notion ID", NotionGeneralSettingHeader: "General Notion Database Settings", - NotionGeneralButton: "Notion General command switch", - NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette", - NotionCustomTitle: "Customise column name", - NotionCustomTitleDesc: "Modify the column name of the Notion database, default (off)", + NotionGeneralButton: "Notion General Sync", + NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette (default: ON)", + NotionCustomTitle: "Customise title property", + NotionCustomTitleDesc: "Modify the column name of the Notion database (default: OFF)", NotionCustomTitleName: "Preferred title name", - NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database", + NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database (default: title)", NotionCustomTitleText: "Enter the name", NotYetFinish: "Not finished. This function will be available in the next version", @@ -53,16 +53,16 @@ export const I18n: { [key: string]: any } = { }, zh: { ribbonIcon: "分享到 NotionNext", - GeneralSetting: "通用信息设置", + GeneralSetting: "通用设置", CommandID: "share-to-notionnext", CommandName: "分享到 NotionNext", CommandIDGeneral: "share-to-notion", CommandNameGeneral: "分享到 Notion 普通数据库", - NotionNextButton: "NotionNext 同步命令开关", - NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中", + NotionNextButton: "NotionNext 同步", + NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中(默认:开)", NotionNextSettingHeader: "NotionNext 数据库参数设置", NotionAPI: "Notion API 令牌", - NotionAPIDesc: "显示为密码", + NotionAPIDesc: "从 https://www.notion.so/my-integrations 生成", NotionAPIText: "输入你的 Notion API 令牌", DatabaseID: "数据库 ID", DatabaseIDText: "输入你的数据库 ID", @@ -72,15 +72,15 @@ export const I18n: { [key: string]: any } = { BannerUrlText: "输入你的封面图片地址", NotionUser: "Notion ID(用户名,可选)", NotionUserDesc: - "你的 Notion ID(可选),分享链接类似:https://username.notion.site/,你的 Notion ID 是 [username]", + "数据库分享链接类似:https://username.notion.site/。你的 Notion ID 是 [username]", NotionUserText: "输入你的 Notion ID", NotionGeneralSettingHeader: "普通 Notion 数据库设置", - NotionGeneralButton: "普通数据库同步命令开关", - NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中", + NotionGeneralButton: "普通数据库同步", + NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中(默认:开)", NotionCustomTitle: "修改 Notion 数据库表头开关", - NotionCustomTitleDesc: "自定义Notion 数据库第一列表头,默认关闭", + NotionCustomTitleDesc: "自定义Notion 数据库第一列表头名(默认:关)", NotionCustomTitleName: "想要修改的表头名", - NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名", + NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名(默认:title)", NotionCustomTitleText: "输入表头名", NotYetFinish: "未完成。此功能将在之后版本中提供", PlaceHolder: "输入数据库名称", From d400b9226323c6f72c699a1d0eb71b05d5eb4d95 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Thu, 16 Nov 2023 11:44:45 +0000 Subject: [PATCH 10/10] update readme --- README-zh.md | 10 ++++++++++ README.md | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/README-zh.md b/README-zh.md index cc7c7e4..55f8238 100644 --- a/README-zh.md +++ b/README-zh.md @@ -3,6 +3,16 @@ 所以我在[原作者](https://github.com/EasyChris/obsidian-to-notion)的基础之上,增加了匹配[NotionNext](https://github.com/tangly1024/NotionNext)模板的功能。这样可以直接在Obsidian编辑,整理好之后一键发布。 ## 更新说明 +### 0.3.0 (大更新) +- 这个版本开始,你可以**任意修改第一列表头的名字 (标题列,默认:'title')**。 (**注意:你必须保证你的Notion数据库中有'tags‘这一列的存在,并且在markdown文件中把`tags:`添加到你的YAML表头中。否则会返回`400 错误`。但是你可以`tags:`设置为空。**) + + ![](https://minioapi.pjx.ac.cn/img1/2023/11/4a298b9be3990e9d2201bf2f50ca5a0a.png) +例如这样: + ![](https://minioapi.pjx.ac.cn/img1/2023/11/4cd8d79cd9dd9dde299e39c666cb3473.gif) +- 增加了一个控制按钮来控制是否开启当前数据库同步命令的功能。如果你关闭了这个按钮,你在上传命令列表中就不会出现当前数据库的选项。 + +![](https://minioapi.pjx.ac.cn/img1/2023/11/becb60fc44783842da4b3cf4c322f363.gif) + ### 0.2.6 - 增加一个按钮用来控制是否在名列列表中显示如下数据库。 diff --git a/README.md b/README.md index 81747c0..304f375 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,22 @@ Thanks to the [original author](https://github.com/EasyChris/obsidian-to-notion) for developing such a useful plugin that can synchronize Obsidian to Notion. However, the original repository can only sync Name and Tags information. For those like me who use [NotionNext](https://github.com/tangly1024/NotionNext) to set up their website, this presents some limitations. Every time I import, I need to make a lot of modifications. Thus, based on the [original author's work](https://github.com/EasyChris/obsidian-to-notion), I've added a feature to match the [NotionNext](https://github.com/tangly1024/NotionNext) template. This way, you can edit directly in Obsidian and publish with a single click after organizing. + +**Now, support both NotionNext and General databases.** + ## Update +### 0.3.0 (Big Update) +- From this version, you can **modify the first column name (title column, default: 'title')** as you want. (**Note: You need to have the 'tags' column in your Notion General database, and add `tags:` in your markdown frontmatter. If not, you will receive `network error 400`. But you can leave the `tags:` blank.**) + +![](https://minioapi.pjx.ac.cn/img1/2023/11/4a298b9be3990e9d2201bf2f50ca5a0a.png) +Like this: +![](https://minioapi.pjx.ac.cn/img1/2023/11/4cd8d79cd9dd9dde299e39c666cb3473.gif) +- Add a switch button to control whether display the setting tabs in the plugin settings for both NotionNext and Notion General databases. + +![](https://minioapi.pjx.ac.cn/img1/2023/11/becb60fc44783842da4b3cf4c322f363.gif) + + + ### 0.2.6 - Add a switch button to control whether to show the upload command in the command palette.