diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dff00..e98b570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -# Changelog v2.2.3 +- Update NotionNext function that + - `tags`, `titleicon`, `slug` and `summary` are now optional. You can remove them from the frontmatter if you don't need them. -## Bug Fixes - -- Fix a bug that 'text' property cannot be synchronized. 修复了一个无法同步'text'属性的bug。 +- 更新 NotionNext 同步功能 + - `tags`, `titleicon`, `slug` 和 `summary` 现在不是必选项了。你可以从你的模板中删除这些字段。 diff --git a/README.md b/README.md index 5889482..fbcfe56 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,13 @@ tags: - web # add more tags if you want --- ``` +
Update + +### 2.2.5 + +- Update NotionNext function that + - `tags`, `titleicon`, `slug` and `summary` are now optional. You can remove them from the frontmatter if you don't need them. -## Update ### 2.2.3 @@ -112,6 +117,8 @@ tags: - [x] 'Phone' - [x] 'File' (**Only support external embedded files**) +
+ ![](https://minioapi.pjx.ac.cn/img1/2024/01/0cd99007409feede77bf5a3291e88af3.png) - Once you create the properties, you can preview the database details in the plugin settings. ![](https://minioapi.pjx.ac.cn/img1/2024/01/665139962cc4cee2a0cb576b508b29f2.png) diff --git a/manifest.json b/manifest.json index 0dda207..35fda33 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "share-to-notionnext", "name": "Share to NotionNext", - "version": "2.2.4", + "version": "2.2.5", "minAppVersion": "0.0.1", "description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.", "author": "EasyChris, jxpeng98", diff --git a/obsidian_template.md b/obsidian_template.md index 78069fa..6125fba 100644 --- a/obsidian_template.md +++ b/obsidian_template.md @@ -12,7 +12,7 @@ date: 2023-07-23 # default is today, 默认是今天。 Format is YYYY-MM-DD coverurl: https://img.jxpeng.dev/2023/08/843e27a210847f05a0f7cfb121fec100.jpg # default is empty, 默认是空 type: Post # Post or Page, default is Post, 默认是Post slug: test # slug for url, default is empty, 默认是空 -stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +status: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft category: test # default is 'Obsidian', 默认是'Obsidian' summary: this is a summary for test post # default is empty, 默认是空 icon: fa-solid fa-camera # you can ignore this, default is empty, 默认是空,可直接删除 diff --git a/package.json b/package.json index 65b917e..bba2393 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "share-to-notionnext", - "version": "2.2.4", + "version": "2.2.5", "type": "module", "description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.", "main": "main.js", diff --git a/src/upload/upload_next/Upload2NotionNext.ts b/src/upload/upload_next/Upload2NotionNext.ts index bba434f..fb2a4ab 100644 --- a/src/upload/upload_next/Upload2NotionNext.ts +++ b/src/upload/upload_next/Upload2NotionNext.ts @@ -88,9 +88,6 @@ export class Upload2NotionNext extends UploadBaseNext { parent: { database_id: databaseID, }, - icon: { - emoji: emoji || '📜' - }, properties: { title: { title: [ @@ -101,25 +98,11 @@ export class Upload2NotionNext extends UploadBaseNext { }, ], }, - tags: { - multi_select: tags && true ? tags.map(tag => { - return { "name": tag } - }) : [], - }, type: { select: { name: type || 'Post' } }, - slug: { - rich_text: [ - { - text: { - content: slug || '' - } - } - ] - }, status: { select: { name: stats || 'Draft' @@ -130,15 +113,7 @@ export class Upload2NotionNext extends UploadBaseNext { name: category || 'Obsidian' } }, - summary: { - rich_text: [ - { - text: { - content: summary || '' - } - } - ] - }, + password: { rich_text: [ { @@ -165,6 +140,52 @@ export class Upload2NotionNext extends UploadBaseNext { }, children: childArr, } + + // add tags + if (tags) { + bodyString.properties.tags = { + multi_select: tags.map(tag => { + return { "name": tag } + }) + } + } + + // add title icon + if (emoji) { + bodyString.icon = { + emoji: emoji + } + } + + // add slug + if (slug) { + bodyString.properties.slug = { + rich_text: [ + { + text: { + content: slug + } + } + ] + } + } + + // check if summary is available + if (summary) { + bodyString.properties.summary = { + rich_text: [ + { + text: { + content: summary + } + } + ] + } + } + + + + if (cover) { bodyString.cover = { type: "external", diff --git a/src/upload/upoload_custom/Upload2NotionCustom.ts b/src/upload/upoload_custom/Upload2NotionCustom.ts index b1a68c3..69998f8 100644 --- a/src/upload/upoload_custom/Upload2NotionCustom.ts +++ b/src/upload/upoload_custom/Upload2NotionCustom.ts @@ -233,5 +233,4 @@ export class Upload2NotionCustom extends UploadBaseCustom { }; } - }