From 01988980861e62dbec213eb1194e125ac499cc4e Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Mon, 29 Jan 2024 11:53:18 +0000 Subject: [PATCH] update the readme and changelog --- CHANGELOG.md | 29 +++++++------- README.md | 29 ++++++++++---- src/ui/CustomModal.ts | 18 ++++----- .../upoload_custom/Upload2NotionCustom.ts | 38 +++++++++++++++++++ 4 files changed, 84 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e4a662..13232b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,19 @@ -# Changelog v2.1.0 +# Changelog v2.2.0 ## Feature -- add confirmation interface for deleting a database -- 增加删除数据库的确认界面 +- add the support for the customised properties of general databases +- 增加对普通数据库自定义属性的支持 -## Fix - -- fix the typo in the edit database modal -- improve the logic for the database editing -- 修复编辑数据库界面的标题错误 -- 改进数据库编辑界面的逻辑 - -## TODO - -- [ ] add the support for the customised properties of general databases -- [ ] 增加对普通数据库自定义属性的支持 +- support + - [x] `title`, which is the first column of the database + - [x] 'Text' + - [x] 'Number' + - [x] 'Date' + - [x] 'Checkbox' + - [x] 'Select' + - [x] 'Multi-select' + - [x] 'URL' + - [x] 'Email' + - [x] 'Phone' + - [x] 'File' (**Only support external embedded files**) diff --git a/README.md b/README.md index 148d388..a31ce33 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ [中文文档](README-zh.md) -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 Tag 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 with customised properties.** **现在支持NotionNext和普通Notion数据库,可自定义数据库列表。** @@ -26,15 +22,34 @@ Thus, based on the [original author's work](https://github.com/EasyChris/obsidia ## Update -### 2.2.0 +### 2.2.0 (Big Update) - add the support for custom properties in the Notion General database. 支持自定义属性 + - [x] `title`, which is the first column of the database + - [x] 'Text' + - [x] 'Number' + - [x] 'Date' + - [x] 'Checkbox' + - [x] 'Select' + - [x] 'Multi-select' + - [x] 'URL' + - [x] 'Email' + - [x] 'Phone' + - [x] 'File' (**Only support external embedded files**) -![](https://minioapi.pjx.ac.cn/img1/2024/01/039760ee966c6c1e04410d3f69787f85.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. +![](https://minioapi.pjx.ac.cn/img1/2024/01/665139962cc4cee2a0cb576b508b29f2.png) -Once you add the custom properties in the Notion General database, you can add the corresponding properties in the YAML frontmatter. **The name of the properties is case sensitive. You should use small letter.** +--- +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 Tag 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. + +--- + +## Archive Update ### 2.1.0 - add confirmation interface for deleting a database 增加删除数据库的确认界面 diff --git a/src/ui/CustomModal.ts b/src/ui/CustomModal.ts index e3428d4..3d5593f 100644 --- a/src/ui/CustomModal.ts +++ b/src/ui/CustomModal.ts @@ -42,7 +42,7 @@ export class CustomModal extends Modal { this.properties[propertyIndex].customType = value; // Update the customType of the specific property }); } - ) + ) } else { propertyLine .setName("Property " + (propertyIndex)) @@ -64,19 +64,19 @@ export class CustomModal extends Modal { .addOption("select", "Select") .addOption("multi_select", "Multi-Select") .addOption("date", "Date") - .addOption("person", "Person") + // .addOption("person", "Person") .addOption("file", "Files & Media") .addOption("checkbox", "Checkbox") .addOption("url", "URL") .addOption("email", "Email") .addOption("phone_number", "Phone Number") - .addOption("formula", "Formula") - .addOption("relation", "Relation") - .addOption("rollup", "Rollup") - .addOption("created_time", "Created time") - .addOption("created_by", "Created by") - .addOption("last_edited_time", "Last Edited Time") - .addOption("last_edited_by", "Last Edited By") + // .addOption("formula", "Formula") + // .addOption("relation", "Relation") + // .addOption("rollup", "Rollup") + // .addOption("created_time", "Created time") + // .addOption("created_by", "Created by") + // .addOption("last_edited_time", "Last Edited Time") + // .addOption("last_edited_by", "Last Edited By") .setValue("text") .onChange(async (value) => { this.properties[propertyIndex].customType = value; // Update the customType of the specific property diff --git a/src/upload/upoload_custom/Upload2NotionCustom.ts b/src/upload/upoload_custom/Upload2NotionCustom.ts index 5e6b6fc..b1a68c3 100644 --- a/src/upload/upoload_custom/Upload2NotionCustom.ts +++ b/src/upload/upoload_custom/Upload2NotionCustom.ts @@ -159,6 +159,44 @@ export class Upload2NotionCustom extends UploadBaseCustom { start: value || new Date().toISOString(), }, }; + case "number": + return { + number: Number(value), + }; + case "phone_number": + return { + phone_number: value, + }; + case "email": + return { + email: value, + }; + case "url": + return { + url: value, + }; + case "files": + return { + files: Array.isArray(value) ? value.map(url => ({ + name: url, + type: "external", + external: { + url: url, + }, + })) : [ + { + name: value, + type: "external", + external: { + url: value, + }, + }, + ], + }; + case "checkbox": + return { + checkbox: Boolean(value) || false, + }; case "select": return { select: {