change tags titleicon and summary to optional function in next database

This commit is contained in:
Jiaxin Peng
2024-03-17 14:36:55 +00:00
parent e0ec27ad07
commit a8ebab7fcb
7 changed files with 62 additions and 35 deletions

View File

@@ -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 - 更新 NotionNext 同步功能
- `tags`, `titleicon`, `slug``summary` 现在不是必选项了。你可以从你的模板中删除这些字段。
- Fix a bug that 'text' property cannot be synchronized. 修复了一个无法同步'text'属性的bug。

View File

@@ -78,8 +78,13 @@ tags:
- web # add more tags if you want - web # add more tags if you want
--- ---
``` ```
<details> <summary> Update </summary>
### 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 ### 2.2.3
@@ -112,6 +117,8 @@ tags:
- [x] 'Phone' - [x] 'Phone'
- [x] 'File' (**Only support external embedded files**) - [x] 'File' (**Only support external embedded files**)
</details>
![](https://minioapi.pjx.ac.cn/img1/2024/01/0cd99007409feede77bf5a3291e88af3.png) ![](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. - 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) ![](https://minioapi.pjx.ac.cn/img1/2024/01/665139962cc4cee2a0cb576b508b29f2.png)

View File

@@ -1,7 +1,7 @@
{ {
"id": "share-to-notionnext", "id": "share-to-notionnext",
"name": "Share to NotionNext", "name": "Share to NotionNext",
"version": "2.2.4", "version": "2.2.5",
"minAppVersion": "0.0.1", "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.", "description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
"author": "EasyChris, jxpeng98", "author": "EasyChris, jxpeng98",

View File

@@ -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 默认是空 coverurl: https://img.jxpeng.dev/2023/08/843e27a210847f05a0f7cfb121fec100.jpg # default is empty 默认是空
type: Post # Post or Page, default is Post 默认是Post type: Post # Post or Page, default is Post 默认是Post
slug: test # slug for url, default is empty 默认是空 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' category: test # default is 'Obsidian' 默认是'Obsidian'
summary: this is a summary for test post # default is empty 默认是空 summary: this is a summary for test post # default is empty 默认是空
icon: fa-solid fa-camera # you can ignore this, default is empty 默认是空,可直接删除 icon: fa-solid fa-camera # you can ignore this, default is empty 默认是空,可直接删除

View File

@@ -1,6 +1,6 @@
{ {
"name": "share-to-notionnext", "name": "share-to-notionnext",
"version": "2.2.4", "version": "2.2.5",
"type": "module", "type": "module",
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.", "description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
"main": "main.js", "main": "main.js",

View File

@@ -88,9 +88,6 @@ export class Upload2NotionNext extends UploadBaseNext {
parent: { parent: {
database_id: databaseID, database_id: databaseID,
}, },
icon: {
emoji: emoji || '📜'
},
properties: { properties: {
title: { title: {
title: [ title: [
@@ -101,25 +98,11 @@ export class Upload2NotionNext extends UploadBaseNext {
}, },
], ],
}, },
tags: {
multi_select: tags && true ? tags.map(tag => {
return { "name": tag }
}) : [],
},
type: { type: {
select: { select: {
name: type || 'Post' name: type || 'Post'
} }
}, },
slug: {
rich_text: [
{
text: {
content: slug || ''
}
}
]
},
status: { status: {
select: { select: {
name: stats || 'Draft' name: stats || 'Draft'
@@ -130,15 +113,7 @@ export class Upload2NotionNext extends UploadBaseNext {
name: category || 'Obsidian' name: category || 'Obsidian'
} }
}, },
summary: {
rich_text: [
{
text: {
content: summary || ''
}
}
]
},
password: { password: {
rich_text: [ rich_text: [
{ {
@@ -165,6 +140,52 @@ export class Upload2NotionNext extends UploadBaseNext {
}, },
children: childArr, 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) { if (cover) {
bodyString.cover = { bodyString.cover = {
type: "external", type: "external",

View File

@@ -233,5 +233,4 @@ export class Upload2NotionCustom extends UploadBaseCustom {
}; };
} }
} }