diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d2e100..4befe55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,12 @@ -## Fix -- fixed the issue that you cannot have empty values in the front matter of the customised database. -- 修复了自定义数据库的前置数据中不能有空值的问题。 -For example, you have the property `tag` in your customised database, and you do not want to sync `tag` to Notion. You can remove the `tag` from the front matter. -- 例如,自定义数据库中有属性`tag`,但是你不想将`tag`同步到Notion。现在,你可以直接在frontmatter中删除`tag`。 +## Feature +- add a notion link display button to control whether to display the synced notion link in the front matter of the markdown file. +- 增加 notion 链接显示按钮,控制是否在 markdown 文件的 front matter 中显示已经生成的 notion 文章链接。 -## Improvement -**⚠️⚠️⚠️: The exist customised database should be recreated if you want to update to version 2.3.0. The new version has a new database structure, and the old database structure is not compatible with the new version to build the index properly.** +Setting tabs: -### 自定义数据库用户 -**⚠️⚠️⚠️: 如果你想要更新到2.3.0版本,你需要重新创建自定义数据库。新版本有一个新的数据库结构,旧的数据库结构无法构建索引。** +![setting tab](https://minioapi.pjx.ac.cn/img1/2024/07/31b2e9844c184bc8fd461b2940c2397a.png) -- redesigned the way to create new customised database. The modal has been removed with a more straightforward layout. -- 重新设计了自定义数据库的创建方式。已删除模态框,采用更直观的布局。 -![](https://minioapi.pjx.ac.cn/img1/2024/07/7a1550aefd71175c981077ce46d03c87.png) +Front matter after sync: - -- improved the edit modal for customised database. The layout has been simplified and the form has been reorganized. -- 改进了自定义数据库的编辑模态框。简化了布局,重新组织了表单。 -![](https://minioapi.pjx.ac.cn/img1/2024/07/471ea519b7cb3fba8f0b57956bb1f973.png) - -- improved the preview modal for customised database. -- 改进了自定义数据库的预览模态框。 -![](https://minioapi.pjx.ac.cn/img1/2024/07/9599d77116afad065d2e31129942acc7.png) +![frontmatter](https://minioapi.pjx.ac.cn/img1/2024/07/d1bd58bf878abfb59dd67986bae99cc4.png) diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index dc390fa..543d6f4 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -12,6 +12,7 @@ export interface PluginSettings { databaseIDNext: string; bannerUrl: string; notionUser: string; + NotionLinkDisplay: boolean; proxy: string; GeneralButton: boolean; tagButton: boolean; @@ -47,6 +48,7 @@ export const DEFAULT_SETTINGS: PluginSettings = { databaseIDNext: "", bannerUrl: "", notionUser: "", + NotionLinkDisplay: true, proxy: "", GeneralButton: true, tagButton: true, @@ -83,6 +85,9 @@ export class ObsidianSettingTab extends PluginSettingTab { this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser') + this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay') + + // add new button new Setting(containerEl) .setName("Add New Database") diff --git a/src/upload/updateYaml.ts b/src/upload/updateYaml.ts index 10d9e83..d479015 100644 --- a/src/upload/updateYaml.ts +++ b/src/upload/updateYaml.ts @@ -12,7 +12,7 @@ export async function updateYamlInfo( ) { let { url, id } = res.json // replace www to notionID - const { notionUser } = plugin.settings; + const { notionUser, NotionLinkDisplay } = plugin.settings; const { abName } = dbDetails const notionIDKey = `NotionID-${abName}`; const linkKey = `link-${abName}`; @@ -31,7 +31,7 @@ export async function updateYamlInfo( } // add new notionID and link yamlContent[notionIDKey] = id; - yamlContent[linkKey] = url; + (NotionLinkDisplay) ? yamlContent[linkKey] = url : null; }); try { @@ -39,17 +39,4 @@ export async function updateYamlInfo( } catch (error) { new Notice(`复制链接失败,请手动复制${error}`) } - // const __content = yamlContent.__content; - // delete yamlContent.__content - // const yamlhead = yaml.stringify(yamlContent) - // // if yamlhead hava last \n remove it - // const yamlhead_remove_n = yamlhead.replace(/\n$/, '') - // // if __content have start \n remove it - // const __content_remove_n = __content.replace(/^\n/, '') - // const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_n; - // try { - // await nowFile.vault.modify(nowFile, content) - // } catch (error) { - // new Notice(`write file error ${error}`) - // } }