mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfbedea91d | ||
|
|
4cd6557444 | ||
|
|
407688c303 | ||
|
|
84b998aa93 | ||
|
|
4b6f1a1f1d |
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
所以我在[原作者](https://github.com/EasyChris/obsidian-to-notion)的基础之上,增加了匹配[NotionNext](https://github.com/tangly1024/NotionNext)模板的功能。这样可以直接在Obsidian编辑,整理好之后一键发布。
|
所以我在[原作者](https://github.com/EasyChris/obsidian-to-notion)的基础之上,增加了匹配[NotionNext](https://github.com/tangly1024/NotionNext)模板的功能。这样可以直接在Obsidian编辑,整理好之后一键发布。
|
||||||
## 更新说明
|
## 更新说明
|
||||||
|
### 0.1.10
|
||||||
|
- 修正了设置中的中文显示。
|
||||||
|
### 0.1.8
|
||||||
|
- 重新整理了代码,增加了一个仓库转换按钮为之后的多数据库支持作准备。**但是现在还不支持多数据库,如果你的数据库不是NotionNext,你可以不用更新。**
|
||||||
### 0.1.7
|
### 0.1.7
|
||||||
- [x] 删除了设置中`convert tags`的选项。 你现在可以直接添加tags,而不需要考虑是否开启tags选项。如果你不需要tags,可以直接删除tags选项或者留白。
|
- [x] 删除了设置中`convert tags`的选项。 你现在可以直接添加tags,而不需要考虑是否开启tags选项。如果你不需要tags,可以直接删除tags选项或者留白。
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Thanks to the [original author](https://github.com/EasyChris/obsidian-to-notion)
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
## Update
|
## Update
|
||||||
|
### 0.1.10
|
||||||
|
- Fix the Chinese support in the settings.
|
||||||
|
### 0.1.8
|
||||||
|
- Rebuild the upload function, and add one button to select the different databases. **However, only NotionNext database is supported for now.**
|
||||||
### 0.1.7
|
### 0.1.7
|
||||||
- [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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "share-to-notionnext",
|
"id": "share-to-notionnext",
|
||||||
"name": "Share to NotionNext",
|
"name": "Share to NotionNext",
|
||||||
"version": "0.1.7",
|
"version": "0.1.10",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "share-to-notionnext",
|
"name": "share-to-notionnext",
|
||||||
"version": "0.1.7",
|
"version": "0.1.10",
|
||||||
"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",
|
||||||
|
|||||||
87
src/BaseUpload2Notion.ts
Normal file
87
src/BaseUpload2Notion.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { App, Notice, requestUrl, TFile } from "obsidian";
|
||||||
|
import { Client } from '@notionhq/client';
|
||||||
|
import { markdownToBlocks, } from "@tryfabric/martian";
|
||||||
|
import * as yamlFrontMatter from "yaml-front-matter";
|
||||||
|
// import * as yaml from "yaml"
|
||||||
|
import MyPlugin from "src/main";
|
||||||
|
|
||||||
|
export class UploadBase {
|
||||||
|
plugin: MyPlugin;
|
||||||
|
notion: Client;
|
||||||
|
agent: any;
|
||||||
|
constructor(plugin: MyPlugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deletePage(notionID: string) {
|
||||||
|
return requestUrl({
|
||||||
|
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + this.plugin.settings.notionAPI,
|
||||||
|
'Notion-Version': '2022-06-28',
|
||||||
|
},
|
||||||
|
body: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataBase(databaseID: string) {
|
||||||
|
const response = await requestUrl({
|
||||||
|
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + this.plugin.settings.notionAPI,
|
||||||
|
'Notion-Version': '2022-06-28',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Check if cover is present in the JSON response and then get the URL
|
||||||
|
if (response.json.cover && response.json.cover.external) {
|
||||||
|
return response.json.cover.external.url;
|
||||||
|
} else {
|
||||||
|
return null; // or some other default value, if you prefer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateYamlInfo(yamlContent: string, nowFile: TFile, res: any, app: App, settings: any) {
|
||||||
|
let { url, id } = res.json
|
||||||
|
// replace www to notionID
|
||||||
|
const { notionID } = settings;
|
||||||
|
if (notionID !== "") {
|
||||||
|
// replace url str "www" to notionID
|
||||||
|
url = url.replace("www.notion.so", `${notionID}.notion.site`)
|
||||||
|
}
|
||||||
|
await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
||||||
|
if (yamlContent['notionID']) {
|
||||||
|
delete yamlContent['notionID']
|
||||||
|
}
|
||||||
|
if (yamlContent['link']) {
|
||||||
|
delete yamlContent['link']
|
||||||
|
}
|
||||||
|
// add new notionID and link
|
||||||
|
yamlContent.notionID = id;
|
||||||
|
yamlContent.link = url;
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(url)
|
||||||
|
} 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}`)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/I18n.ts
Normal file
46
src/I18n.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
export const I18n: { [key: string]: any } = {
|
||||||
|
"en": {
|
||||||
|
ribbonIcon: "Share to NotionNext",
|
||||||
|
CommandName: "share to notionnext",
|
||||||
|
NotionNextVersion: "NotionNext Version Database",
|
||||||
|
NotionNextVersionDesc: "Turn on this option if you are using NotionNext",
|
||||||
|
NotionNextSetting: "NotionNext Database Settings",
|
||||||
|
NotionAPI: "Notion API Token",
|
||||||
|
NotionAPIDesc: "It's a secret",
|
||||||
|
NotionAPIText:"Enter your Notion API Token",
|
||||||
|
NotionID: "Database ID",
|
||||||
|
NotionIDText: "Enter your Database ID",
|
||||||
|
BannerUrl: "Banner url(optional)",
|
||||||
|
BannerUrlDesc: "page banner url(optional), default is empty, if you want to show a banner, please enter the url(like:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)",
|
||||||
|
BannerUrlText: "Enter your banner url",
|
||||||
|
NotionUser: "Notion ID(username, optional)",
|
||||||
|
NotionUserDesc: "Your notion ID (optional),share link likes:https://username.notion.site/,your notion id is [username]",
|
||||||
|
NotionUserText: "Enter your notion ID (options)",
|
||||||
|
NotionGeneralSetting: "General Notion Database Settings",
|
||||||
|
NotYetFinish: "Not finished. This function will be available in the next version",
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
ribbonIcon: "分享到 NotionNext",
|
||||||
|
CommandName: "分享到 NotionNext",
|
||||||
|
NotionNextVersion: "NotionNext 版本数据库",
|
||||||
|
NotionNextVersionDesc: "如果你使用的是NotionNext,请打开此选项",
|
||||||
|
NotionNextSetting: "NotionNext 数据库参数设置",
|
||||||
|
NotionAPI: "Notion API 令牌",
|
||||||
|
NotionAPIDesc: "显示为密码",
|
||||||
|
NotionAPIText:"输入你的 Notion API 令牌",
|
||||||
|
NotionID: "数据库 ID",
|
||||||
|
NotionIDText: "输入你的数据库 ID",
|
||||||
|
BannerUrl: "封面图片地址(可选)",
|
||||||
|
BannerUrlDesc: "页面封面图片地址(可选),默认为空,如果你想显示封面图片,请输入图片地址(例如:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)",
|
||||||
|
BannerUrlText: "输入你的封面图片地址",
|
||||||
|
NotionUser: "Notion ID(用户名,可选)",
|
||||||
|
NotionUserDesc: "你的 Notion ID(可选),分享链接类似:https://username.notion.site/,你的 Notion ID 是 [username]",
|
||||||
|
NotionUserText: "输入你的 Notion ID(可选)",
|
||||||
|
NotionGeneralSetting: "普通 Notion 数据库设置",
|
||||||
|
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const I18nConfig = (lang: any): any => {
|
||||||
|
return I18n[lang]
|
||||||
|
}
|
||||||
@@ -1,23 +1,29 @@
|
|||||||
export const NoticeMsg: {[key: string]:any} = {
|
export const NoticeMsg: { [key: string]: any } = {
|
||||||
"en": {
|
"en": {
|
||||||
"notion-logo": "Share to NotionNext",
|
"notion-logo": "Share to NotionNext",
|
||||||
"sync-success": "Sync to NotionNext success: \n",
|
"sync-success": "Sync to NotionNext success: \n",
|
||||||
"sync-fail": "Sync to NotionNext fail: \n",
|
"sync-fail": "Sync to NotionNext fail: \n",
|
||||||
"open-notion": "Please open the file that needs to be synchronized",
|
"open-notion": "Please open the file that needs to be synchronized",
|
||||||
"config-secrets-notion-api": "Please set up the notion API in the settings tab.",
|
"config-secrets-notion-api": "Please set up the notion API in the settings tab.",
|
||||||
"config-secrets-database-id": "Please set up the database id in the settings tab.",
|
"config-secrets-database-id": "Please set up the database id in the settings tab.",
|
||||||
"set-tags-fail": "Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.",
|
"set-tags-fail": "Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.",
|
||||||
},
|
"NNonMissing": "The 'NNon' property is missing in the settings. Please set it up.",
|
||||||
"zh": {
|
"set-api-id": "Please set up the notion API and database ID in the settings tab."
|
||||||
"notion-logo": "分享到NotionNext",
|
},
|
||||||
"sync-success": "同步到NotionNext成功:\n",
|
"zh": {
|
||||||
"sync-fail": "同步到NotionNext失败: \n",
|
"notion-logo": "分享到NotionNext",
|
||||||
"open-file": "请打开需要同步的文件",
|
"sync-success": "同步到NotionNext成功:\n",
|
||||||
"set-tags-fail": "设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
"sync-fail": "同步到NotionNext失败: \n",
|
||||||
},
|
"open-file": "请打开需要同步的文件",
|
||||||
|
"config-secrets-notion-api": "请在插件设置中添加notion API",
|
||||||
|
"config-secrets-database-id": "请在插件设置中添加database id",
|
||||||
|
"set-tags-fail": "设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
||||||
|
"NNonMissing": "未设置'NNon'属性,请在插件设置中选择NotionNext数据库。",
|
||||||
|
"set-api-id": "请在插件设置中设置notion API和database ID"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const NoticeMConfig = (lang:any) :any => {
|
export const NoticeMConfig = (lang: any): any => {
|
||||||
return NoticeMsg[lang]
|
return NoticeMsg[lang]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import {UploadBase} from "./BaseUpload2Notion";
|
||||||
import { App, Notice, requestUrl, TFile } from "obsidian";
|
import { App, Notice, requestUrl, TFile } from "obsidian";
|
||||||
import { Client } from '@notionhq/client';
|
import { Client } from '@notionhq/client';
|
||||||
import { markdownToBlocks, } from "@tryfabric/martian";
|
import { markdownToBlocks, } from "@tryfabric/martian";
|
||||||
@@ -5,44 +6,9 @@ import * as yamlFrontMatter from "yaml-front-matter";
|
|||||||
// import * as yaml from "yaml"
|
// import * as yaml from "yaml"
|
||||||
import MyPlugin from "src/main";
|
import MyPlugin from "src/main";
|
||||||
|
|
||||||
export class Upload2Notion {
|
export class Upload2Notion extends UploadBase {
|
||||||
plugin: MyPlugin;
|
|
||||||
notion: Client;
|
|
||||||
agent: any;
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: MyPlugin) {
|
||||||
this.plugin = plugin;
|
super(plugin);
|
||||||
}
|
|
||||||
|
|
||||||
async deletePage(notionID: string) {
|
|
||||||
return requestUrl({
|
|
||||||
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPI,
|
|
||||||
'Notion-Version': '2022-06-28',
|
|
||||||
},
|
|
||||||
body: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getDataBase(databaseID: string) {
|
|
||||||
const response = await requestUrl({
|
|
||||||
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPI,
|
|
||||||
'Notion-Version': '2022-06-28',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Check if cover is present in the JSON response and then get the URL
|
|
||||||
if (response.json.cover && response.json.cover.external) {
|
|
||||||
return response.json.cover.external.url;
|
|
||||||
} else {
|
|
||||||
return null; // or some other default value, if you prefer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 因为需要解析notion的block进行对比,非常的麻烦,
|
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||||
@@ -56,7 +22,8 @@ export class Upload2Notion {
|
|||||||
cover = databasecover
|
cover = databasecover
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.createPage(title,
|
return await this.createPage(
|
||||||
|
title,
|
||||||
emoji,
|
emoji,
|
||||||
cover,
|
cover,
|
||||||
tags,
|
tags,
|
||||||
@@ -208,44 +175,4 @@ export class Upload2Notion {
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateYamlInfo(yamlContent: string, nowFile: TFile, res: any, app: App, settings: any) {
|
|
||||||
let { url, id } = res.json
|
|
||||||
// replace www to notionID
|
|
||||||
const { notionID } = settings;
|
|
||||||
if (notionID !== "") {
|
|
||||||
// replace url str "www" to notionID
|
|
||||||
url = url.replace("www.notion.so", `${notionID}.notion.site`)
|
|
||||||
}
|
|
||||||
await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
|
||||||
if (yamlContent['notionID']) {
|
|
||||||
delete yamlContent['notionID']
|
|
||||||
}
|
|
||||||
if (yamlContent['link']) {
|
|
||||||
delete yamlContent['link']
|
|
||||||
}
|
|
||||||
// add new notionID and link
|
|
||||||
yamlContent.notionID = id;
|
|
||||||
yamlContent.link = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(url)
|
|
||||||
} 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}`)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
179
src/Upload2Notion_NN.ts
Normal file
179
src/Upload2Notion_NN.ts
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
import {UploadBase} from "./BaseUpload2Notion";
|
||||||
|
import { App, Notice, requestUrl, TFile } from "obsidian";
|
||||||
|
import { Client } from '@notionhq/client';
|
||||||
|
import { markdownToBlocks, } from "@tryfabric/martian";
|
||||||
|
import * as yamlFrontMatter from "yaml-front-matter";
|
||||||
|
// import * as yaml from "yaml"
|
||||||
|
import MyPlugin from "src/main";
|
||||||
|
|
||||||
|
export class Upload2NotionNext extends UploadBase {
|
||||||
|
constructor(plugin: MyPlugin) {
|
||||||
|
super(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||||
|
// 暂时就直接删除,新建一个page
|
||||||
|
async updatePage(notionID: string, title: string, emoji: string, cover: string, tags: string[], type: string, slug: string, stats: string, category: string, summary: string, paword: string, favicon: string, datetime: string, childArr: any) {
|
||||||
|
await this.deletePage(notionID)
|
||||||
|
|
||||||
|
const databasecover = await this.getDataBase(this.plugin.settings.databaseID)
|
||||||
|
|
||||||
|
if (cover == null) {
|
||||||
|
cover = databasecover
|
||||||
|
}
|
||||||
|
|
||||||
|
return await this.createPage(
|
||||||
|
title,
|
||||||
|
emoji,
|
||||||
|
cover,
|
||||||
|
tags,
|
||||||
|
type,
|
||||||
|
slug,
|
||||||
|
stats,
|
||||||
|
category,
|
||||||
|
summary,
|
||||||
|
paword,
|
||||||
|
favicon,
|
||||||
|
datetime,
|
||||||
|
childArr)
|
||||||
|
}
|
||||||
|
|
||||||
|
async createPage(title: string, emoji: string, cover: string, tags: string[], type: string, slug: string, stats: string, category: string, summary: string, pawrod: string, favicon: string, datetime: string, childArr: any) {
|
||||||
|
const bodyString: any = {
|
||||||
|
parent: {
|
||||||
|
database_id: this.plugin.settings.databaseID
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
emoji: emoji || '📜'
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
title: {
|
||||||
|
title: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: title
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
category: {
|
||||||
|
select: {
|
||||||
|
name: category || 'Obsidian'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
summary: {
|
||||||
|
rich_text: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: summary || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
rich_text: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: pawrod || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
rich_text: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: favicon || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
date: {
|
||||||
|
date: {
|
||||||
|
start: datetime || new Date().toISOString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: childArr,
|
||||||
|
}
|
||||||
|
if (cover) {
|
||||||
|
bodyString.cover = {
|
||||||
|
type: "external",
|
||||||
|
external: {
|
||||||
|
url: cover
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bodyString.cover && this.plugin.settings.bannerUrl) {
|
||||||
|
bodyString.cover = {
|
||||||
|
type: "external",
|
||||||
|
external: {
|
||||||
|
url: this.plugin.settings.bannerUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return await requestUrl({
|
||||||
|
url: `https://api.notion.com/v1/pages`,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
// 'User-Agent': 'obsidian.md',
|
||||||
|
'Authorization': 'Bearer ' + this.plugin.settings.notionAPI,
|
||||||
|
'Notion-Version': '2022-06-28',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(bodyString),
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
new Notice(`network error ${error}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async syncMarkdownToNotion(title: string, emoji: string, cover: string, tags: string[], type: string, slug: string, stats: string, category: string, summary: string, paword: string, favicon: string, datetime: string, markdown: string, nowFile: TFile, app: App, settings: any): Promise<any> {
|
||||||
|
let res: any
|
||||||
|
const yamlContent: any = yamlFrontMatter.loadFront(markdown);
|
||||||
|
const __content = yamlContent.__content
|
||||||
|
const file2Block = markdownToBlocks(__content);
|
||||||
|
const frontmasster = app.metadataCache.getFileCache(nowFile)?.frontmatter
|
||||||
|
const notionID = frontmasster ? frontmasster.notionID : null
|
||||||
|
|
||||||
|
if (notionID) {
|
||||||
|
res = await this.updatePage(notionID, title, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, file2Block);
|
||||||
|
} else {
|
||||||
|
res = await this.createPage(title, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, file2Block);
|
||||||
|
}
|
||||||
|
if (res.status === 200) {
|
||||||
|
await this.updateYamlInfo(markdown, nowFile, res, app, settings)
|
||||||
|
} else {
|
||||||
|
new Notice(`${res.text}`)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
449
src/main.ts
449
src/main.ts
@@ -1,241 +1,282 @@
|
|||||||
import {App, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting} from "obsidian";
|
import {App, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting} from "obsidian";
|
||||||
import {addIcons} from 'src/icon';
|
import {addIcons} from 'src/icon';
|
||||||
import {Upload2Notion} from "src/Upload2Notion";
|
import {Upload2Notion} from "src/Upload2Notion";
|
||||||
|
import {Upload2NotionNext} from "src/Upload2Notion_NN";
|
||||||
import {NoticeMConfig} from "src/Message";
|
import {NoticeMConfig} from "src/Message";
|
||||||
|
import {I18nConfig} from "src/I18n";
|
||||||
|
|
||||||
// Remember to rename these classes and interfaces!
|
// Remember to rename these classes and interfaces!
|
||||||
|
|
||||||
interface PluginSettings {
|
interface PluginSettings {
|
||||||
notionAPI: string;
|
NNon: boolean;
|
||||||
databaseID: string;
|
notionAPI: string;
|
||||||
bannerUrl: string;
|
databaseID: string;
|
||||||
notionID: string;
|
bannerUrl: string;
|
||||||
proxy: string;
|
notionID: string;
|
||||||
allowTags: boolean;
|
proxy: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const langConfig = NoticeMConfig( window.localStorage.getItem('language') || 'en')
|
const langConfig = NoticeMConfig(window.localStorage.getItem('language') || 'en')
|
||||||
|
|
||||||
|
const i18nConfig = I18nConfig(window.localStorage.getItem('language') || 'en')
|
||||||
|
|
||||||
const DEFAULT_SETTINGS: PluginSettings = {
|
const DEFAULT_SETTINGS: PluginSettings = {
|
||||||
notionAPI: "",
|
NNon: undefined,
|
||||||
databaseID: "",
|
notionAPI: "",
|
||||||
bannerUrl: "",
|
databaseID: "",
|
||||||
notionID: "",
|
bannerUrl: "",
|
||||||
proxy: "",
|
notionID: "",
|
||||||
allowTags: false
|
proxy: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class ObsidianSyncNotionPlugin extends Plugin {
|
export default class ObsidianSyncNotionPlugin extends Plugin {
|
||||||
settings: PluginSettings;
|
settings: PluginSettings;
|
||||||
async onload() {
|
|
||||||
await this.loadSettings();
|
|
||||||
addIcons();
|
|
||||||
// This creates an icon in the left ribbon.
|
|
||||||
const ribbonIconEl = this.addRibbonIcon(
|
|
||||||
"notion-logo",
|
|
||||||
"Share to NotionNext",
|
|
||||||
async (evt: MouseEvent) => {
|
|
||||||
// Called when the user clicks the icon.
|
|
||||||
await this.upload();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
|
async onload() {
|
||||||
const statusBarItemEl = this.addStatusBarItem();
|
await this.loadSettings();
|
||||||
// statusBarItemEl.setText("share to notion");
|
addIcons();
|
||||||
|
// This creates an icon in the left ribbon.
|
||||||
|
const ribbonIconEl = this.addRibbonIcon(
|
||||||
|
"notion-logo",
|
||||||
|
i18nConfig.ribbonIcon,
|
||||||
|
async (evt: MouseEvent) => {
|
||||||
|
// Called when the user clicks the icon.
|
||||||
|
await this.upload();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.addCommand({
|
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
|
||||||
id: "share-to-notionnext",
|
const statusBarItemEl = this.addStatusBarItem();
|
||||||
name: "share to notionnext",
|
// statusBarItemEl.setText("share to notion");
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
|
||||||
await this.upload()
|
this.addCommand({
|
||||||
},
|
id: "share-to-notionnext",
|
||||||
});
|
name: i18nConfig.CommandName,
|
||||||
|
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
||||||
|
await this.upload()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// This adds a settings tab so the user can configure various aspects of the plugin
|
// This adds a settings tab so the user can configure various aspects of the plugin
|
||||||
this.addSettingTab(new ObsidianSettingTab(this.app, this));
|
this.addSettingTab(new ObsidianSettingTab(this.app, this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onunload() {}
|
onunload() {
|
||||||
|
}
|
||||||
|
|
||||||
async upload(){
|
async upload() {
|
||||||
const { notionAPI, databaseID, allowTags } = this.settings;
|
const { notionAPI, databaseID, NNon} = this.settings;
|
||||||
if (notionAPI === "" || databaseID === "") {
|
|
||||||
new Notice(
|
|
||||||
"Please set up the notion API and database ID in the settings tab."
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime } =await this.getNowFileMarkdownContent(this.app);
|
|
||||||
|
|
||||||
if (markDownData) {
|
// Check if NNon exists
|
||||||
const { basename } = nowFile;
|
if (NNon === undefined) {
|
||||||
const upload = new Upload2Notion(this);
|
const NNonmessage = langConfig.NNonMissing;
|
||||||
const res = await upload.syncMarkdownToNotion(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app, this.settings)
|
new Notice(NNonmessage);
|
||||||
if(res.status === 200){
|
|
||||||
new Notice(`${langConfig["sync-success"]}${basename}`)
|
|
||||||
}else {
|
|
||||||
new Notice(`${langConfig["sync-fail"]}${basename}`, 5000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async getNowFileMarkdownContent(app: App) {
|
|
||||||
const nowFile = app.workspace.getActiveFile();
|
|
||||||
const { allowTags } = this.settings;
|
|
||||||
let emoji = ''
|
|
||||||
let cover = ''
|
|
||||||
let tags = []
|
|
||||||
let type = ''
|
|
||||||
let slug = ''
|
|
||||||
let stats = ''
|
|
||||||
let category = ''
|
|
||||||
let summary = ''
|
|
||||||
let paword = ''
|
|
||||||
let favicon = ''
|
|
||||||
let datetime = ''
|
|
||||||
|
|
||||||
const FileCache = app.metadataCache.getFileCache(nowFile)
|
|
||||||
try {
|
|
||||||
if(allowTags) {
|
|
||||||
emoji = FileCache.frontmatter.titleicon;
|
|
||||||
cover = FileCache.frontmatter.coverurl;
|
|
||||||
tags = FileCache.frontmatter.tags;
|
|
||||||
type = FileCache.frontmatter.type;
|
|
||||||
slug = FileCache.frontmatter.slug;
|
|
||||||
stats = FileCache.frontmatter.stats;
|
|
||||||
category = FileCache.frontmatter.category;
|
|
||||||
summary = FileCache.frontmatter.summary;
|
|
||||||
paword = FileCache.frontmatter.password;
|
|
||||||
favicon = FileCache.frontmatter.icon;
|
|
||||||
datetime = FileCache.frontmatter.date;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
new Notice(langConfig["set-tags-fail"]);
|
|
||||||
}
|
|
||||||
if (nowFile) {
|
|
||||||
const markDownData = await nowFile.vault.read(nowFile);
|
|
||||||
return {
|
|
||||||
markDownData,
|
|
||||||
nowFile,
|
|
||||||
emoji,
|
|
||||||
cover,
|
|
||||||
tags,
|
|
||||||
type,
|
|
||||||
slug,
|
|
||||||
stats,
|
|
||||||
category,
|
|
||||||
summary,
|
|
||||||
paword,
|
|
||||||
favicon,
|
|
||||||
datetime,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
new Notice(langConfig["open-file"]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async loadSettings() {
|
// Check if the user has set up the Notion API and database ID
|
||||||
this.settings = Object.assign(
|
if (notionAPI === "" || databaseID === "") {
|
||||||
{},
|
const setAPIMessage = langConfig["set-api-id"];
|
||||||
DEFAULT_SETTINGS,
|
new Notice(setAPIMessage);
|
||||||
await this.loadData()
|
return;
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async saveSettings() {
|
const {markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime} = await this.getNowFileMarkdownContent(this.app);
|
||||||
await this.saveData(this.settings);
|
|
||||||
}
|
|
||||||
|
if (markDownData) {
|
||||||
|
const { basename } = nowFile;
|
||||||
|
let upload;
|
||||||
|
|
||||||
|
if (NNon) {
|
||||||
|
upload = new Upload2NotionNext(this);
|
||||||
|
} else {
|
||||||
|
upload = new Upload2Notion(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await upload.syncMarkdownToNotion(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app, this.settings);
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
new Notice(`${langConfig["sync-success"]}${basename}`);
|
||||||
|
} else {
|
||||||
|
new Notice(`${langConfig["sync-fail"]}${basename}`, 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNowFileMarkdownContent(app: App) {
|
||||||
|
const nowFile = app.workspace.getActiveFile();
|
||||||
|
const {NNon} = this.settings;
|
||||||
|
let emoji = ''
|
||||||
|
let cover = ''
|
||||||
|
let tags = []
|
||||||
|
let type = ''
|
||||||
|
let slug = ''
|
||||||
|
let stats = ''
|
||||||
|
let category = ''
|
||||||
|
let summary = ''
|
||||||
|
let paword = ''
|
||||||
|
let favicon = ''
|
||||||
|
let datetime = ''
|
||||||
|
|
||||||
|
const FileCache = app.metadataCache.getFileCache(nowFile)
|
||||||
|
try {
|
||||||
|
if (NNon) {
|
||||||
|
emoji = FileCache.frontmatter.titleicon;
|
||||||
|
cover = FileCache.frontmatter.coverurl;
|
||||||
|
tags = FileCache.frontmatter.tags;
|
||||||
|
type = FileCache.frontmatter.type;
|
||||||
|
slug = FileCache.frontmatter.slug;
|
||||||
|
stats = FileCache.frontmatter.stats;
|
||||||
|
category = FileCache.frontmatter.category;
|
||||||
|
summary = FileCache.frontmatter.summary;
|
||||||
|
paword = FileCache.frontmatter.password;
|
||||||
|
favicon = FileCache.frontmatter.icon;
|
||||||
|
datetime = FileCache.frontmatter.date;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
new Notice(langConfig["set-tags-fail"]);
|
||||||
|
}
|
||||||
|
if (nowFile) {
|
||||||
|
const markDownData = await nowFile.vault.read(nowFile);
|
||||||
|
return {
|
||||||
|
markDownData,
|
||||||
|
nowFile,
|
||||||
|
emoji,
|
||||||
|
cover,
|
||||||
|
tags,
|
||||||
|
type,
|
||||||
|
slug,
|
||||||
|
stats,
|
||||||
|
category,
|
||||||
|
summary,
|
||||||
|
paword,
|
||||||
|
favicon,
|
||||||
|
datetime,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
new Notice(langConfig["open-file"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadSettings() {
|
||||||
|
this.settings = Object.assign(
|
||||||
|
{},
|
||||||
|
DEFAULT_SETTINGS,
|
||||||
|
await this.loadData()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async saveSettings() {
|
||||||
|
await this.saveData(this.settings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObsidianSettingTab extends PluginSettingTab {
|
class ObsidianSettingTab extends PluginSettingTab {
|
||||||
plugin: ObsidianSyncNotionPlugin;
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
|
||||||
constructor(app: App, plugin: ObsidianSyncNotionPlugin) {
|
constructor(app: App, plugin: ObsidianSyncNotionPlugin) {
|
||||||
super(app, plugin);
|
super(app, plugin);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
display(): void {
|
display(): void {
|
||||||
const { containerEl } = this;
|
const {containerEl} = this;
|
||||||
|
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName(i18nConfig.NotionNextVersion)
|
||||||
|
.setDesc(i18nConfig.NotionNextVersionDesc)
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle
|
||||||
|
.setValue(this.plugin.settings.NNon)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.NNon = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
containerEl.createEl('h2', {text: i18nConfig.NotionNextSetting})
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName(i18nConfig.NotionAPI)
|
||||||
|
.setDesc(i18nConfig.NotionAPIDesc)
|
||||||
|
.addText((text) => {
|
||||||
|
text.inputEl.type = 'password';
|
||||||
|
return text
|
||||||
|
.setPlaceholder(i18nConfig.NotionAPIText)
|
||||||
|
.setValue(this.plugin.settings.notionAPI)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.notionAPI = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const notionDatabaseID = new Setting(containerEl)
|
||||||
|
.setName(i18nConfig.NotionID)
|
||||||
|
.setDesc(i18nConfig.NotionAPIDesc)
|
||||||
|
.addText((text) => {
|
||||||
|
text.inputEl.type = 'password';
|
||||||
|
return text
|
||||||
|
.setPlaceholder(i18nConfig.NotionIDText)
|
||||||
|
.setValue(this.plugin.settings.databaseID)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.databaseID = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// notionDatabaseID.controlEl.querySelector('input').type='password'
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName(i18nConfig.BannerUrl)
|
||||||
|
.setDesc(i18nConfig.BannerUrlDesc)
|
||||||
|
.addText((text) =>
|
||||||
|
text
|
||||||
|
.setPlaceholder(i18nConfig.BannerUrlText)
|
||||||
|
.setValue(this.plugin.settings.bannerUrl)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.bannerUrl = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName(i18nConfig.NotionUser)
|
||||||
|
.setDesc(i18nConfig.NotionUserDesc)
|
||||||
|
.addText((text) =>
|
||||||
|
text
|
||||||
|
.setPlaceholder(i18nConfig.NotionUserText)
|
||||||
|
.setValue(this.plugin.settings.notionID)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.notionID = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// General Database Settings
|
||||||
|
containerEl.createEl('h2', {text: i18nConfig.NotionGeneralSetting});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("Notion API Token")
|
.setName(i18nConfig.NotYetFinish)
|
||||||
.setDesc("It's a secret")
|
|
||||||
.addText((text) =>{
|
|
||||||
text.inputEl.type = 'password';
|
|
||||||
return text
|
|
||||||
.setPlaceholder("Enter your Notion API Token")
|
|
||||||
.setValue(this.plugin.settings.notionAPI)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.notionAPI = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// new Setting(containerEl)
|
||||||
const notionDatabaseID = new Setting(containerEl)
|
// .setName("Convert tags(optional)")
|
||||||
.setName("Database ID")
|
// .setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'")
|
||||||
.setDesc("It's a secret")
|
// .addToggle((toggle) =>
|
||||||
.addText((text) => {
|
// toggle
|
||||||
text.inputEl.type = 'password';
|
// .setValue(this.plugin.settings.allowTags)
|
||||||
return text
|
// .onChange(async (value) => {
|
||||||
.setPlaceholder("Enter your Database ID")
|
// this.plugin.settings.allowTags = value;
|
||||||
.setValue(this.plugin.settings.databaseID)
|
// await this.plugin.saveSettings();
|
||||||
.onChange(async (value) => {
|
// })
|
||||||
this.plugin.settings.databaseID = value;
|
// );
|
||||||
await this.plugin.saveSettings();
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// notionDatabaseID.controlEl.querySelector('input').type='password'
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName("Banner url(optional)")
|
|
||||||
.setDesc("page banner url(optional), default is empty, if you want to show a banner, please enter the url(like:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)")
|
|
||||||
.addText((text) =>
|
|
||||||
text
|
|
||||||
.setPlaceholder("Enter banner pic url: ")
|
|
||||||
.setValue(this.plugin.settings.bannerUrl)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.bannerUrl = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName("Notion ID(optional)")
|
|
||||||
.setDesc("Your notion ID(optional),share link likes:https://username.notion.site/,your notion id is [username]")
|
|
||||||
.addText((text) =>
|
|
||||||
text
|
|
||||||
.setPlaceholder("Enter notion ID(options) ")
|
|
||||||
.setValue(this.plugin.settings.notionID)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.notionID = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// new Setting(containerEl)
|
|
||||||
// .setName("Convert tags(optional)")
|
|
||||||
// .setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'")
|
|
||||||
// .addToggle((toggle) =>
|
|
||||||
// toggle
|
|
||||||
// .setValue(this.plugin.settings.allowTags)
|
|
||||||
// .onChange(async (value) => {
|
|
||||||
// this.plugin.settings.allowTags = value;
|
|
||||||
// await this.plugin.saveSettings();
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user