Compare commits

..

9 Commits
2.2.0 ... 2.2.5

Author SHA1 Message Date
Jiaxin Peng
a8ebab7fcb change tags titleicon and summary to optional function in next database 2024-03-17 14:36:55 +00:00
Jiaxin Peng
e0ec27ad07 update readme 2024-03-12 22:04:34 +00:00
Jiaxin Peng
85220105b0 update README 2024-03-08 15:23:17 +00:00
Jiaxin Peng
9afdb24a82 typo 2024-02-26 11:57:28 +00:00
Jiaxin Peng
3c7ab13995 update readme 2024-02-26 11:53:02 +00:00
Jiaxin Peng
31b72f3bd3 Update version to 2.2.4 2024-02-19 23:08:47 +00:00
Jiaxin Peng
ee5aada1b9 Update version to 2.2.3 2024-02-19 20:51:47 +00:00
Jiaxin Peng
9e15044f6a Update version to 2.2.2 2024-02-16 23:10:22 +00:00
Jiaxin Peng
9d891dae55 Update version to 2.2.1 2024-01-29 20:43:14 +00:00
14 changed files with 270 additions and 151 deletions

View File

@@ -7,7 +7,7 @@ on:
env: env:
PLUGIN_NAME: share-to-notionnext # Change this to match the id of your plugin. PLUGIN_NAME: share-to-notionnext # Change this to match the id of your plugin.
CHANGELOG_FILENAME: CHANGELOG.md
jobs: jobs:
build: build:
name: release name: release
@@ -20,13 +20,13 @@ jobs:
with: with:
node-version: "18" node-version: "18"
- name: Generate changelog # - name: Generate changelog
id: changelog # id: changelog
uses: saadmk11/changelog-ci@v1.1.2 # uses: saadmk11/changelog-ci@v1.1.2
with: # with:
github_token: ${{ secrets.REPO_ACCESS_TOKEN }} # github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
release_version: ${{ github.ref }} # release_version: ${{ github.ref }}
changelog_filename: CHANGELOG.md # changelog_filename: CHANGELOG.md
- name: Build - name: Build
id: build id: build
@@ -48,6 +48,7 @@ jobs:
with: with:
tag_name: ${{ github.ref }} tag_name: ${{ github.ref }}
release_name: ${{ github.ref }} release_name: ${{ github.ref }}
body_path: ${{ env.CHANGELOG_FILENAME }}
draft: false draft: false
prerelease: false prerelease: false

View File

@@ -1,19 +1,5 @@
# Changelog v2.2.0 - 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.
## Feature - 更新 NotionNext 同步功能
- `tags`, `titleicon`, `slug``summary` 现在不是必选项了。你可以从你的模板中删除这些字段。
- 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**)

106
README.md
View File

@@ -3,10 +3,11 @@
[![Test](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml/badge.svg)](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml) [![Test](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml/badge.svg)](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml)
[![Release](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml/badge.svg)](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml) [![Release](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml/badge.svg)](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml)
[![Obsidian Downloads](https://img.shields.io/badge/dynamic/json?logo=obsidian&color=%23483699&label=downloads&query=%24%5B%22share-to-notionnext%22%5D.downloads&url=https%3A%2F%2Fraw.githubusercontent.com%2Fobsidianmd%2Fobsidian-releases%2Fmaster%2Fcommunity-plugin-stats.json)](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/) [![Obsidian Downloads](https://img.shields.io/badge/dynamic/json?logo=obsidian&color=%23483699&label=downloads&query=%24%5B%22share-to-notionnext%22%5D.downloads&url=https%3A%2F%2Fraw.githubusercontent.com%2Fobsidianmd%2Fobsidian-releases%2Fmaster%2Fcommunity-plugin-stats.json)](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/)
[![GitHub release (with filter)](https://img.shields.io/github/v/release/jxpeng98/obsidian-to-NotionNext)](https://github.com/jxpeng98/obsidian-to-NotionNext/releases/) [![GitHub release (with filter)](https://img.shields.io/github/package-json/v/jxpeng98/obsidian-to-NotionNext)](https://github.com/jxpeng98/obsidian-to-NotionNext/releases/)
[//]: # ([![Github all releases](https://img.shields.io/github/downloads/jxpeng98/obsidian-to-NotionNext/total.svg)](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/)) [//]: # ([![Github all releases](https://img.shields.io/github/downloads/jxpeng98/obsidian-to-NotionNext/total.svg)](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/))
[中文文档](README-zh.md) [中文文档](README-zh.md)
**Now, support both NotionNext and General databases with customised properties.** **Now, support both NotionNext and General databases with customised properties.**
@@ -15,12 +16,91 @@
## TODO List ## TODO List
- [x] Support custom properties for Notion General database. 支持自定义属性 - [ ] Modify the Edit function for the custom properties. 改进自定义属性的编辑功能
- [ ] Support group upload with one click 支持一键多数据库上传 - [ ] Support group upload with one click 支持一键多数据库上传
- [x] Support custom properties for Notion General database. 支持自定义属性
- [x] Support preview for database details in plugin settings. 支持预览数据库详情 - [x] Support preview for database details in plugin settings. 支持预览数据库详情
- [x] Support edit for database details in plugin settings. 支持编辑数据库详情 - [x] Support edit for database details in plugin settings. 支持编辑数据库详情
## Update ## How to use
You need seven steps to use this plugin in your Obsidian.
1. Create a database in your Notion workspace.
Open Notion, clink the `+` button on the left side, and 'Add a page' -> select 'Table' -> 'New database'.
2. On the right-top corner, click the 'Share' -> 'Publish' -> 'Publish' -> copy the database id from the URL.
3. go to [Notion API](https://www.notion.com/my-integrations) to create a new integration, and copy the token.
4. Go back to your created Notion database, click the right-top '...' -> connections -> connect to -> find the integration you created and connect it.
5. Go to obsidian settings -> community plugins -> search 'NotionNext' -> install it.
6. Create a database in the plugin settings, and fill in the database details and all properties you want to sync (**Note: the name of the properties is case-sensitive.**).
- There are three type of database that you can use:
- NotionNext: the database for the NotionNext template.(**All the properties are in lowercase**)
- General: the database for the general Notion database (**Only have `title` and `tags` columns**)
- Custom: the database for the custom properties (You can customise the properties you want to sync)
7. Create a new note in Obsidian, and fill in the frontmatter with the properties you want to sync.
## 使用方法
如果你想使用这个插件,你需要完成下边的七个步骤。
1. 首先在你的Notion中创建一个数据库。
2. 点击右上角的'分享' -> '发布' -> '发布' -> 然后复制URL中的数据库ID。(版本不同可能id的形式也不同。只需要复制在之前的纯数字部分应该就可以了)
3. 去[Notion API](https://www.notion.com/my-integrations)创建一个新的API然后复制token。
4. 回到你创建的Notion数据库点击右上角的'...' -> 连接 -> 连接到 -> 把你刚才创建的API绑定到你的数据库
5. 回到Obsidian的设置 -> 社区插件 -> 搜索'NotionNext' -> 安装
6. 在插件设置中创建一个数据库,然后填写数据库的详情和你想要同步的属性 (**注意Notion会识别表头的大小写一定要和notion中的表头保持大小写一致**)。
- 你可以使用三种类型的数据库:
- NotionNext: 用于NotionNext模板的数据库。(**默认全部小写**)
- General: 用于普通的Notion数据库**只有`title``tags`两个属性**
- Custom: 用于自定义属性的数据库(你可以自定义你想要同步的属性)
7. 在Obsidian中创建一个新的笔记然后在frontmatter中写入你想要的属性。
## Example
```plain
---
# default value has been set.
# for any unwanted value, you can delete it or set it to empty.
# for example, if you donot want to set password, you can delete password: "1234" or set it to password: ""
# 我已经在插件中设置了默认值,如果有不需要的选项,可以直接删除。
# 例如你不需要密码选项你可以将password: "1234"删除,或者将它设置为空。
# !!!!!!!!!!!!
# 现在阶段一定不要修改表头的名字, please do not change the name of the header in YAML front matter
# !!!!!!!!!!!!
titleicon: 📎 # emoji icon, default is 📜, 默认是📜
date: 2023-07-23 # default is today 默认是今天。 Format is YYYY-MM-DD 格式是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 默认是空
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 默认是空,可直接删除
password: "1234" # if you donot want to set password, you can delete this line, default is empty 默认是空,可直接删除
# 现在必须开启tags选项否则会报错
tags:
- test # tags for post
- 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.
### 2.2.3
- Fix a bug that 'text' property cannot be synchronized. 修复了一个无法同步'text'属性的bug。
### 2.2.2
- Fix the setting description of database. 修复数据库设置的描述错误。
### 2.2.1
- improve the localisation for the custom properties setting. 改进自定义属性设置的本地化。
**Warning: the edit function for the custom properties is not perfect for now. You need to re-enter all the properties if you want to edit the properties.**
**注意:自定义属性的编辑功能现在还不完善。如果你想编辑属性,你需要重新输入所有的属性。**
### 2.2.0 (Big Update) ### 2.2.0 (Big Update)
@@ -37,6 +117,8 @@
- [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)
@@ -51,7 +133,8 @@ Thus, based on the [original author's work](https://github.com/EasyChris/obsidia
--- ---
## Archive Update <details> <summary> Archive Update </summary>
### 2.1.0 ### 2.1.0
- add confirmation interface for deleting a database 增加删除数据库的确认界面 - add confirmation interface for deleting a database 增加删除数据库的确认界面
@@ -188,7 +271,9 @@ If you turn off the button for the NotionNext database, you won't see the option
- [x] Removed the `convert tag` option. Now, you can directly add tags in the YAML front matter. If you don't want to add tags, you can delete the tags in the YAML front matter or leave the tags blank. - [x] Removed the `convert tag` option. Now, you can directly add tags in the YAML front matter. If you don't want to add tags, you can delete the tags in the YAML front matter or leave the tags blank.
## How to Use </details>
<details> <summary> Previous How to Use </summary>
### Precautions ### Precautions
@@ -280,9 +365,11 @@ Usage of the template is as follows:
**Plugin preview is shown below** **Plugin preview is shown below**
![](https://minioapi.pjx.ac.cn/img1/2023/09/d6199619b68fab218fca8ae0cebece78.gif) ![](https://minioapi.pjx.ac.cn/img1/2023/09/d6199619b68fab218fca8ae0cebece78.gif)
</details>
--- ---
**Original README.md** <details> <summary> Original README.md </summary>
Many Thanks for the original author's work. I've only made some changes to the original author's work. If you find this plugin useful, please give the [original author](https://github.com/EasyChris/obsidian-to-notion) a star. Many Thanks for the original author's work. I've only made some changes to the original author's work. If you find this plugin useful, please give the [original author](https://github.com/EasyChris/obsidian-to-notion) a star.
@@ -456,10 +543,6 @@ node update-version.js
./release.sh ./release.sh
``` ```
```
# Thanks # Thanks
[Development Process | Obsidian Plugin Development Documentation](https://luhaifeng666.github.io/obsidian-plugin-docs-zh/zh/getting-started/development-workflow.html) [Development Process | Obsidian Plugin Development Documentation](https://luhaifeng666.github.io/obsidian-plugin-docs-zh/zh/getting-started/development-workflow.html)
@@ -476,3 +559,6 @@ node update-version.js
# License # License
GNU GPLv3 GNU GPLv3
</details>

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.0", "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.0", "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

@@ -23,10 +23,11 @@ export const en = {
NotionAPIDesc: "Generate from https://www.notion.so/my-integrations", NotionAPIDesc: "Generate from https://www.notion.so/my-integrations",
NotionAPIText: "Enter your Notion API Token", NotionAPIText: "Enter your Notion API Token",
DatabaseID: "Database ID", DatabaseID: "Database ID",
DatabaseIDDesc: "Collect from the top-right Share --> Publish",
DatabaseIDText: "Enter your Database ID", DatabaseIDText: "Enter your Database ID",
BannerUrl: "Banner url (optional)", BannerUrl: "Banner url (optional)",
BannerUrlDesc: 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://abc.com/b.png)",
BannerUrlText: "Enter your banner url", BannerUrlText: "Enter your banner url",
NotionUser: "Notion ID (username, optional)", NotionUser: "Notion ID (username, optional)",
NotionUserDesc: NotionUserDesc:
@@ -65,4 +66,11 @@ export const en = {
NotionCustomSettingHeader: "Notion Custom Database Settings", NotionCustomSettingHeader: "Notion Custom Database Settings",
NotionCustomButton: "Notion Customised command switch", NotionCustomButton: "Notion Customised command switch",
NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette", NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette",
CustomPropertyName: "Property Name",
CustomPropertyFirstColumn: "Title Column",
CustomPropertyFirstColumnDesc: "The title of the page, must be the first property",
CustomProperty: "Property",
AddCustomProperty: "Add Custom Property",
AddNewProperty: "Add New Property",
AddNewPropertyDesc: "Add new property match with your notion database",
} }

View File

@@ -23,9 +23,10 @@ export const ja = {
NotionAPIDesc: "https://www.notion.so/my-integrations から生成してください", NotionAPIDesc: "https://www.notion.so/my-integrations から生成してください",
NotionAPIText: "Notion API トークンを入力", NotionAPIText: "Notion API トークンを入力",
DatabaseID: "データベースID", DatabaseID: "データベースID",
DatabaseIDDesc: "右上の共有 --> 公開から取得してください",
DatabaseIDText: "データベースIDを入力", DatabaseIDText: "データベースIDを入力",
BannerUrl: "バナーのURL任意", BannerUrl: "バナーのURL任意",
BannerUrlDesc: "デフォルトは空白です。バナーを表示したい場合は、URLを入力してくださいhttps://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png", BannerUrlDesc: "デフォルトは空白です。バナーを表示したい場合は、URLを入力してくださいhttps://abc.com/b.png",
BannerUrlText: "バナーのURLを入力", BannerUrlText: "バナーのURLを入力",
NotionUser: "Notion IDユーザー名、任意", NotionUser: "Notion IDユーザー名、任意",
NotionUserDesc: "共有リンクから取得https://username.notion.site。Notion IDは[username]です", NotionUserDesc: "共有リンクから取得https://username.notion.site。Notion IDは[username]です",
@@ -57,4 +58,11 @@ export const ja = {
NotionCustomSettingHeader: "Notionカスタムデータベース設定", NotionCustomSettingHeader: "Notionカスタムデータベース設定",
NotionCustomButton: "Notionカスタマイズコマンドの切り替え", NotionCustomButton: "Notionカスタマイズコマンドの切り替え",
NotionCustomButtonDesc: "このオプションを開くと、Notionカスタムデータベース同期コマンドがコマンドパレットに表示されます", NotionCustomButtonDesc: "このオプションを開くと、Notionカスタムデータベース同期コマンドがコマンドパレットに表示されます",
CustomPropertyName: "カスタムプロパティ名",
CustomPropertyFirstColumn: "最初の列のカスタムプロパティ名",
CustomPropertyFirstColumnDesc: "最初の列のカスタムプロパティ名を入力してください",
CustomProperty: "カスタムプロパティ",
AddCustomProperty: "カスタムプロパティを追加",
AddNewProperty: "新しいプロパティを追加",
AddNewPropertyDesc: "新しいプロパティを追加してください",
}; };

View File

@@ -23,10 +23,11 @@ export const zh = {
NotionAPIDesc: "从 https://www.notion.so/my-integrations 生成", NotionAPIDesc: "从 https://www.notion.so/my-integrations 生成",
NotionAPIText: "输入你的 Notion API 令牌", NotionAPIText: "输入你的 Notion API 令牌",
DatabaseID: "数据库 ID", DatabaseID: "数据库 ID",
DatabaseIDDesc: "从右上角的分享 --> 发布中获取",
DatabaseIDText: "输入你的数据库 ID", DatabaseIDText: "输入你的数据库 ID",
BannerUrl: "封面图片地址(可选)", BannerUrl: "封面图片地址(可选)",
BannerUrlDesc: BannerUrlDesc:
"默认为空如果你想显示封面图片请输入图片地址例如https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png", "默认为空如果你想显示封面图片请输入图片地址例如https://abc.com/b.png",
BannerUrlText: "输入你的封面图片地址", BannerUrlText: "输入你的封面图片地址",
NotionUser: "Notion ID用户名可选", NotionUser: "Notion ID用户名可选",
NotionUserDesc: NotionUserDesc:
@@ -60,4 +61,11 @@ export const zh = {
NotionCustomSettingHeader: "Notion 自定义数据库设置", NotionCustomSettingHeader: "Notion 自定义数据库设置",
NotionCustomButton: "Notion 自定义数据库同步命令开关", NotionCustomButton: "Notion 自定义数据库同步命令开关",
NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中", NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中",
CustomPropertyName: "自定义属性名",
CustomPropertyFirstColumn: "第一列属性名",
CustomPropertyFirstColumnDesc: "第一列必须为标题属性名",
CustomProperty: "自定义属性",
AddCustomProperty: "添加自定义属性",
AddNewProperty: "添加新属性",
AddNewPropertyDesc: "添加一个和Notion数据库匹配的新属性",
} }

View File

@@ -1,6 +1,7 @@
import {App, Modal, Setting} from "obsidian"; import {App, Modal, Setting} from "obsidian";
import ObsidianSyncNotionPlugin from "../main"; import ObsidianSyncNotionPlugin from "../main";
import {ObsidianSettingTab} from "./settingTabs"; import {ObsidianSettingTab} from "./settingTabs";
import {i18nConfig} from "../lang/I18n";
export class CustomModal extends Modal { export class CustomModal extends Modal {
propertyLines: Setting[] = []; // Store all property line settings propertyLines: Setting[] = []; // Store all property line settings
@@ -20,8 +21,8 @@ export class CustomModal extends Modal {
if (propertyIndex === 0) { if (propertyIndex === 0) {
propertyLine propertyLine
.setName("Title") .setName(i18nConfig.CustomPropertyFirstColumn)
.setDesc("The title of the page, must be the first property") .setDesc(i18nConfig.CustomPropertyFirstColumnDesc)
propertyLine.addText((text) => { propertyLine.addText((text) => {
text text
@@ -45,11 +46,11 @@ export class CustomModal extends Modal {
) )
} else { } else {
propertyLine propertyLine
.setName("Property " + (propertyIndex)) .setName(i18nConfig.CustomProperty + (propertyIndex))
propertyLine.addText((text) => { propertyLine.addText((text) => {
text text
.setPlaceholder("Property name") .setPlaceholder(i18nConfig.CustomPropertyName)
.setValue("") .setValue("")
.onChange(async (value) => { .onChange(async (value) => {
this.properties[propertyIndex].customName = value; // Update the customValue of the specific property this.properties[propertyIndex].customName = value; // Update the customValue of the specific property
@@ -59,13 +60,14 @@ export class CustomModal extends Modal {
propertyLine.addDropdown((dropdown) => { propertyLine.addDropdown((dropdown) => {
dropdown dropdown
// .addOption("none", '')
.addOption("text", "Text") .addOption("text", "Text")
.addOption("number", "Number") .addOption("number", "Number")
.addOption("select", "Select") .addOption("select", "Select")
.addOption("multi_select", "Multi-Select") .addOption("multi_select", "Multi-Select")
.addOption("date", "Date") .addOption("date", "Date")
// .addOption("person", "Person") // .addOption("person", "Person")
.addOption("file", "Files & Media") .addOption("files", "Files & Media")
.addOption("checkbox", "Checkbox") .addOption("checkbox", "Checkbox")
.addOption("url", "URL") .addOption("url", "URL")
.addOption("email", "Email") .addOption("email", "Email")
@@ -77,7 +79,7 @@ export class CustomModal extends Modal {
// .addOption("created_by", "Created by") // .addOption("created_by", "Created by")
// .addOption("last_edited_time", "Last Edited Time") // .addOption("last_edited_time", "Last Edited Time")
// .addOption("last_edited_by", "Last Edited By") // .addOption("last_edited_by", "Last Edited By")
.setValue("text") .setValue("")
.onChange(async (value) => { .onChange(async (value) => {
this.properties[propertyIndex].customType = value; // Update the customType of the specific property this.properties[propertyIndex].customType = value; // Update the customType of the specific property
}); });
@@ -104,7 +106,7 @@ export class CustomModal extends Modal {
display(): void { display(): void {
this.containerEl.addClass("custom-modal"); this.containerEl.addClass("custom-modal");
this.titleEl.setText("Add Custom Property"); this.titleEl.setText(i18nConfig.AddCustomProperty);
let {contentEl} = this; let {contentEl} = this;
contentEl.empty(); contentEl.empty();
@@ -112,8 +114,8 @@ export class CustomModal extends Modal {
const customDiv = contentEl.createDiv("custom-div"); const customDiv = contentEl.createDiv("custom-div");
new Setting(customDiv) new Setting(customDiv)
.setName("Add new property") .setName(i18nConfig.AddNewProperty)
.setDesc("Add new property match with your notion database") .setDesc(i18nConfig.AddNewPropertyDesc)
.addButton((button) => { .addButton((button) => {
return button return button
.setTooltip("Add") .setTooltip("Add")

View File

@@ -200,7 +200,7 @@ export class EditModal extends SettingModal {
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp','notionAPITemp') this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp','notionAPITemp')
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp','databaseIDTemp') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp','databaseIDTemp')
} else if (value === 'next') { } else if (value === 'next') {
@@ -217,7 +217,7 @@ export class EditModal extends SettingModal {
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp','notionAPITemp') this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp','notionAPITemp')
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp','databaseIDTemp') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp','databaseIDTemp')
} else if (value === 'custom') { } else if (value === 'custom') {
@@ -233,7 +233,7 @@ export class EditModal extends SettingModal {
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp', 'notionAPITemp') this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp', 'notionAPITemp')
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp', 'databaseIDTemp') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp', 'databaseIDTemp')
// add new property button // add new property button
new Setting(nextTabs) new Setting(nextTabs)

View File

@@ -178,7 +178,7 @@ export class SettingModal extends Modal {
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI') this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI')
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
} else if (value === 'next') { } else if (value === 'next') {
@@ -196,7 +196,7 @@ export class SettingModal extends Modal {
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
} else if (value === 'custom') { } else if (value === 'custom') {
@@ -212,7 +212,7 @@ export class SettingModal extends Modal {
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI') this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI')
// add database id // add database id
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID') this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
// add new property button // add new property button
new Setting(nextTabs) new Setting(nextTabs)

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 {
}; };
} }
} }