mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
800e218dee | ||
|
|
3b774552af | ||
| b8a02c49f1 | |||
|
|
046a67f22c | ||
| 426f05dfbd | |||
|
|
0addaa0d7f | ||
| 1d5792c966 | |||
|
|
193d3f6f87 | ||
| e9c2b4aada | |||
| b5ac42e6e3 | |||
| 60d002677b | |||
| 3c3ec6881e | |||
|
|
a80155fafc | ||
| 3a814b8390 | |||
| bb522db9a2 | |||
| 201f72ae0e | |||
| be6f192dd8 | |||
| 4ce1019094 | |||
| 095c608511 | |||
| 2d8d7fb11a | |||
| 36725cb699 | |||
|
|
654e7e854d | ||
|
|
fa67f08512 | ||
|
|
7e42ef49a7 | ||
|
|
5a95aa0acc | ||
|
|
ded01ce678 | ||
|
|
3535d9fc70 | ||
|
|
9c93e38aff | ||
|
|
bfde5dfe1a | ||
|
|
d8eb3c8984 | ||
|
|
1cee2b67a6 | ||
|
|
82529ce56a | ||
|
|
70f30f0713 | ||
|
|
24ebb0bf8a | ||
|
|
d7372c7c55 | ||
|
|
f7bcf71020 | ||
|
|
72146afe48 | ||
|
|
9bcdb42edb | ||
|
|
16e0827991 | ||
|
|
863a6fb0dc | ||
|
|
5799ffe79b | ||
|
|
a8ebab7fcb | ||
|
|
e0ec27ad07 | ||
|
|
85220105b0 | ||
|
|
9afdb24a82 | ||
|
|
3c7ab13995 | ||
|
|
31b72f3bd3 | ||
|
|
ee5aada1b9 | ||
|
|
9e15044f6a | ||
|
|
9d891dae55 | ||
|
|
bc665253ec | ||
|
|
125c75f7c0 | ||
|
|
8248640b5f | ||
|
|
0198898086 | ||
|
|
8c6aea8250 | ||
|
|
a179d3da52 | ||
|
|
569d8eb699 | ||
|
|
2a58dd3258 | ||
|
|
8c65e471eb | ||
|
|
388693d5b4 | ||
|
|
dda6710fe9 | ||
|
|
76ea9a4aee | ||
|
|
856f83e8a1 | ||
|
|
f670dd972a | ||
|
|
e6de2d036a | ||
|
|
dd131f5df1 | ||
|
|
a9fb81fc1b | ||
|
|
4f21e3ff91 | ||
|
|
4abbbecd37 | ||
|
|
35746f1c51 | ||
|
|
9ac64268fc | ||
|
|
3123d91e97 | ||
|
|
cf08703fea | ||
|
|
fb463ceaae | ||
|
|
306573d81e | ||
|
|
fb5f7b502d | ||
|
|
59c15f1206 | ||
|
|
370444fb94 | ||
|
|
11aaf14c0b | ||
|
|
f3fb251cf7 | ||
|
|
913fa4dd03 | ||
|
|
f638310f31 | ||
|
|
c2421f7a84 | ||
|
|
6c30d0c2b4 | ||
|
|
ccb5a20abe |
143
.github/workflows/release.yml
vendored
143
.github/workflows/release.yml
vendored
@@ -7,85 +7,94 @@ 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
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "18"
|
node-version: "18"
|
||||||
|
|
||||||
- name: Build
|
# - name: Generate changelog
|
||||||
id: build
|
# id: changelog
|
||||||
run: |
|
# uses: saadmk11/changelog-ci@v1.1.2
|
||||||
npm install
|
# with:
|
||||||
npm run build
|
# github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
mkdir ${{ env.PLUGIN_NAME }}
|
# release_version: ${{ github.ref }}
|
||||||
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
|
# changelog_filename: CHANGELOG.md
|
||||||
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
|
|
||||||
ls
|
|
||||||
echo "tag_name=$(git tag --sort version:refname | tail -n 1)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Create Release
|
- name: Build
|
||||||
id: create_release
|
id: build
|
||||||
uses: actions/create-release@v1
|
run: |
|
||||||
env:
|
npm install
|
||||||
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
npm run build
|
||||||
VERSION: ${{ github.ref }}
|
mkdir ${{ env.PLUGIN_NAME }}
|
||||||
with:
|
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
|
||||||
tag_name: ${{ github.ref }}
|
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
|
||||||
release_name: ${{ github.ref }}
|
ls
|
||||||
draft: false
|
echo "tag_name=$(git tag --sort version:refname | tail -n 1)" >> $GITHUB_OUTPUT
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Upload zip file
|
- name: Create Release
|
||||||
id: upload-zip
|
id: create_release
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/create-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
with:
|
VERSION: ${{ github.ref }}
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
with:
|
||||||
asset_path: ./${{ env.PLUGIN_NAME }}.zip
|
tag_name: ${{ github.ref }}
|
||||||
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
|
release_name: ${{ github.ref }}
|
||||||
asset_content_type: application/zip
|
body_path: ${{ env.CHANGELOG_FILENAME }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
- name: Upload main.js
|
- name: Upload zip file
|
||||||
id: upload-main
|
id: upload-zip
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ./main.js
|
asset_path: ./${{ env.PLUGIN_NAME }}.zip
|
||||||
asset_name: main.js
|
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
|
||||||
asset_content_type: text/javascript
|
asset_content_type: application/zip
|
||||||
|
|
||||||
- name: Upload manifest.json
|
- name: Upload main.js
|
||||||
id: upload-manifest
|
id: upload-main
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ./manifest.json
|
asset_path: ./main.js
|
||||||
asset_name: manifest.json
|
asset_name: main.js
|
||||||
asset_content_type: application/json
|
asset_content_type: text/javascript
|
||||||
|
|
||||||
- name: Upload markdown template
|
- name: Upload manifest.json
|
||||||
id: upload-md
|
id: upload-manifest
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ./obsidian_template.md
|
asset_path: ./manifest.json
|
||||||
asset_name: template.md
|
asset_name: manifest.json
|
||||||
asset_content_type: text/markdown
|
asset_content_type: application/json
|
||||||
|
|
||||||
|
- name: Upload markdown template
|
||||||
|
id: upload-md
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./obsidian_template.md
|
||||||
|
asset_name: template.md
|
||||||
|
asset_content_type: text/markdown
|
||||||
|
|
||||||
# - name: Upload styles.css
|
# - name: Upload styles.css
|
||||||
# id: upload-css
|
# id: upload-css
|
||||||
|
|||||||
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "*"
|
||||||
- "!master"
|
|
||||||
|
|
||||||
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.
|
||||||
|
|||||||
4
CHANGELOG.md
Normal file
4
CHANGELOG.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
## Improvements
|
||||||
|
|
||||||
|
- update the Markdown parser to ensure that no extra `\\` is added to the end of the line when having equations in the Markdown file
|
||||||
|
- 输入公式的时候,不会在公式后面加上多余的`\\`符号
|
||||||
11
README-zh.md
11
README-zh.md
@@ -5,6 +5,17 @@
|
|||||||
所以我在[原作者](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编辑,整理好之后一键发布。
|
||||||
|
|
||||||
## 更新说明
|
## 更新说明
|
||||||
|
### 1.1.2
|
||||||
|
- 修复了一个拼写错误,导致无法同步`status`到NotionNext。现在你可以使用`stats`或者`status`来同步文章的状态到NotionNext。这个更新不会影响到同步到General数据库的功能。
|
||||||
|
- **`stats`和`status`都可以使用,但是你只能使用其中一个。**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft
|
||||||
|
# or
|
||||||
|
status: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft
|
||||||
|
# both of them will work, but you can only use one of them.
|
||||||
|
```
|
||||||
|
|
||||||
### 1.1.1
|
### 1.1.1
|
||||||
- 修复了在日语系统下,无法显示设置按钮的错误。
|
- 修复了在日语系统下,无法显示设置按钮的错误。
|
||||||
- 增加日语翻译。
|
- 增加日语翻译。
|
||||||
|
|||||||
632
README.html
632
README.html
@@ -1,632 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
|
||||||
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="generator" content="quarto-1.3.450">
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
||||||
|
|
||||||
|
|
||||||
<title>readme</title>
|
|
||||||
<style>
|
|
||||||
code{white-space: pre-wrap;}
|
|
||||||
span.smallcaps{font-variant: small-caps;}
|
|
||||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
|
||||||
div.column{flex: auto; overflow-x: auto;}
|
|
||||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
|
||||||
ul.task-list{list-style: none;}
|
|
||||||
ul.task-list li input[type="checkbox"] {
|
|
||||||
width: 0.8em;
|
|
||||||
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
/* CSS for syntax highlighting */
|
|
||||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
|
||||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
|
||||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
|
||||||
.sourceCode { overflow: visible; }
|
|
||||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
|
||||||
div.sourceCode { margin: 1em 0; }
|
|
||||||
pre.sourceCode { margin: 0; }
|
|
||||||
@media screen {
|
|
||||||
div.sourceCode { overflow: auto; }
|
|
||||||
}
|
|
||||||
@media print {
|
|
||||||
pre > code.sourceCode { white-space: pre-wrap; }
|
|
||||||
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
|
||||||
}
|
|
||||||
pre.numberSource code
|
|
||||||
{ counter-reset: source-line 0; }
|
|
||||||
pre.numberSource code > span
|
|
||||||
{ position: relative; left: -4em; counter-increment: source-line; }
|
|
||||||
pre.numberSource code > span > a:first-child::before
|
|
||||||
{ content: counter(source-line);
|
|
||||||
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
|
||||||
border: none; display: inline-block;
|
|
||||||
-webkit-touch-callout: none; -webkit-user-select: none;
|
|
||||||
-khtml-user-select: none; -moz-user-select: none;
|
|
||||||
-ms-user-select: none; user-select: none;
|
|
||||||
padding: 0 4px; width: 4em;
|
|
||||||
}
|
|
||||||
pre.numberSource { margin-left: 3em; padding-left: 4px; }
|
|
||||||
div.sourceCode
|
|
||||||
{ }
|
|
||||||
@media screen {
|
|
||||||
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="README_files/libs/clipboard/clipboard.min.js"></script>
|
|
||||||
<script src="README_files/libs/quarto-html/quarto.js"></script>
|
|
||||||
<script src="README_files/libs/quarto-html/popper.min.js"></script>
|
|
||||||
<script src="README_files/libs/quarto-html/tippy.umd.min.js"></script>
|
|
||||||
<script src="README_files/libs/quarto-html/anchor.min.js"></script>
|
|
||||||
<link href="README_files/libs/quarto-html/tippy.css" rel="stylesheet">
|
|
||||||
<link href="README_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
|
|
||||||
<script src="README_files/libs/bootstrap/bootstrap.min.js"></script>
|
|
||||||
<link href="README_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
|
||||||
<link href="README_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="fullcontent">
|
|
||||||
|
|
||||||
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
|
|
||||||
|
|
||||||
<main class="content" id="quarto-document-content">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<section id="obsidian-to-notionnext" class="level1">
|
|
||||||
<h1>Obsidian to NotionNext</h1>
|
|
||||||
<p><a href="https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml"><img src="https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml/badge.svg" class="img-fluid" alt="test.yml"></a> <a href="https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml"><img src="https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml/badge.svg" class="img-fluid" alt="Release Obsidian plugin"></a> <a href="https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/"><img src="https://img.shields.io/github/downloads/jxpeng98/obsidian-to-NotionNext/total.svg" class="img-fluid" alt="Github all releases"></a> <a href="https://github.com/jxpeng98/obsidian-to-NotionNext/releases"><img src="https://badgen.net/github/release/jxpeng98/obsidian-to-NotionNext.png" class="img-fluid" alt="GitLab latest release"></a></p>
|
|
||||||
<p><a href="README-zh.md">中文文档</a></p>
|
|
||||||
<p>Thanks to the <a href="https://github.com/EasyChris/obsidian-to-notion">original author</a> for developing such a useful plugin that can synchronize Obsidian to Notion. However, the original repository can only sync Name and Tags information. For those like me who use <a href="https://github.com/tangly1024/NotionNext">NotionNext</a> to set up their website, this presents some limitations. Every time I import, I need to make a lot of modifications.</p>
|
|
||||||
<p>Thus, based on the <a href="https://github.com/EasyChris/obsidian-to-notion">original author’s work</a>, I’ve added a feature to match the <a href="https://github.com/tangly1024/NotionNext">NotionNext</a> template. This way, you can edit directly in Obsidian and publish with a single click after organizing.</p>
|
|
||||||
<p><strong>Now, support both NotionNext and General databases.</strong></p>
|
|
||||||
<section id="update" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="update">Update</h2>
|
|
||||||
<section id="section" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section">1.0.1</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Fix the custom name element display bug in the settings.</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="big-update" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="big-update">1.0.0 (Big Update)</h3>
|
|
||||||
<ul>
|
|
||||||
<li>From this version, you can <strong>modify the first column name (title column, default: ‘title’)</strong> as you want. (<strong>Note: You need to have the ‘tags’ column in your Notion General database, and add <code>tags:</code> in your markdown frontmatter. If not, you will receive <code>network error 400</code>. But you can leave the <code>tags:</code> blank.</strong>)</li>
|
|
||||||
</ul>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/4a298b9be3990e9d2201bf2f50ca5a0a.png" class="img-fluid"> Like this: <img src="https://minioapi.pjx.ac.cn/img1/2023/11/4cd8d79cd9dd9dde299e39c666cb3473.gif" class="img-fluid"></p>
|
|
||||||
<ul>
|
|
||||||
<li>Add a switch button to control whether display the setting tabs in the plugin settings for both NotionNext and Notion General databases.</li>
|
|
||||||
</ul>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/becb60fc44783842da4b3cf4c322f363.gif" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="section-1" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-1">0.2.6</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Add a switch button to control whether to show the upload command in the command palette.</li>
|
|
||||||
</ul>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/147c6a4eaa34da41a6f102558ed77106.png" class="img-fluid"> If you turn off the button for the General database, you won’t see the option for the General database in the upload command list.</p>
|
|
||||||
<p>If you turn off the button for the NotionNext database, you won’t see the option for the NotionNext database in the upload command list.</p>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/70b8e4fc2148688ccbd6cfc53ce339a2.png" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="section-2" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-2">0.2.3</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Fix the bug, now you can update normally.</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="section-3" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-3">0.2.2</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Support both NotionNext and General Notion database.</li>
|
|
||||||
<li>You can have one NotionNext and one General Notion database.</li>
|
|
||||||
<li>General Notion database can only have <code>title</code> and <code>tags</code> columns, and <code>tags</code> columns should be the multi-selected property. <strong>the name of the columns is case sensitive. You should use small letter.</strong></li>
|
|
||||||
</ul>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/712a12081d855aa60f82a7b46913ab7e.gif" class="img-fluid"></p>
|
|
||||||
<p><img src="https://minioapi.pjx.ac.cn/img1/2023/11/9de76cecceef74c78884ddfc1c221659.gif" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="section-4" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-4">0.2.1</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Restructure the code</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="section-5" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-5">0.2.0</h3>
|
|
||||||
<ul>
|
|
||||||
<li>From this version, the interactive logic has been rewritten. When you click the ribbon icon, it will display the sync command for all presetting NotionNext databases. You can choose the database you want to sync to. <strong>However, only NotionNext database is supported for now.</strong></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="section-6" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-6">0.1.10</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Fix the Chinese support in the settings.</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="section-7" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-7">0.1.8</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Rebuild the uploadCommand function, and add one button to select the different databases. <strong>However, only NotionNext database is supported for now.</strong></li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<section id="section-8" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="section-8">0.1.7</h3>
|
|
||||||
<ul class="task-list">
|
|
||||||
<li><input type="checkbox" checked="">Removed the <code>convert tag</code> 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.</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="how-to-use" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="how-to-use">How to Use</h2>
|
|
||||||
<section id="precautions" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="precautions">Precautions</h3>
|
|
||||||
<p>For now, this plugin is exclusively for <a href="https://github.com/tangly1024/NotionNext">NotionNext</a>. If you’re not using this template, you’ll keep receiving <code>error 400</code>.</p>
|
|
||||||
<p>For those without a NotionNext requirement, please use the original <a href="https://github.com/EasyChris/obsidian-to-notion">Obsidian-to-notion</a>.</p>
|
|
||||||
</section>
|
|
||||||
<section id="pre-installation-steps" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="pre-installation-steps">Pre-Installation Steps</h3>
|
|
||||||
<p>Before installing the plugin, you must have set up the following:</p>
|
|
||||||
<ol type="1">
|
|
||||||
<li>Your NotionNext database.</li>
|
|
||||||
<li>According to the original author’s readme.md, set up the Notion API, and it should already be associated with your NotionNext repository.</li>
|
|
||||||
<li>NotionNext Database ID</li>
|
|
||||||
<li>Your NotionNext database should have the following contents:
|
|
||||||
<ul>
|
|
||||||
<li>type</li>
|
|
||||||
<li>title</li>
|
|
||||||
<li>slug</li>
|
|
||||||
<li>category</li>
|
|
||||||
<li>tags</li>
|
|
||||||
<li>date</li>
|
|
||||||
<li>status</li>
|
|
||||||
<li>summary</li>
|
|
||||||
<li>password</li>
|
|
||||||
<li>icon</li>
|
|
||||||
</ul></li>
|
|
||||||
</ol>
|
|
||||||
<p>From version 0.0.6, I also add the following contents: - titleicon: the unique icon for each post, it can only support emoji currently. - cover url: the cover image for each post, it should be end with a type of image, such as .jpg, .png, .gif, etc.</p>
|
|
||||||
<p><strong>If you’ve directly copied the NotionNext template, these contents should already exist. I’ve made changes to this plugin based on the original author’s work. All you need to ensure is that your database has the above content, and every letter is in lowercase!!!</strong></p>
|
|
||||||
<p><strong>⚠️⚠️⚠️: All headers are in lowercase!!! The order doesn’t matter!</strong></p>
|
|
||||||
</section>
|
|
||||||
<section id="plugin-installation" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="plugin-installation">Plugin Installation</h3>
|
|
||||||
<section id="install-via-community-plugins" class="level4">
|
|
||||||
<h4 class="anchored" data-anchor-id="install-via-community-plugins">Install via Community Plugins</h4>
|
|
||||||
<p>Open <code>Obsidian settings -> Community Plugins -> Browse -> NotionNext -> Share to NotionNext</code></p>
|
|
||||||
</section>
|
|
||||||
<section id="mannually-install" class="level4">
|
|
||||||
<h4 class="anchored" data-anchor-id="mannually-install">Mannually Install</h4>
|
|
||||||
<ol type="1">
|
|
||||||
<li>Close Obsidian.</li>
|
|
||||||
<li>Download the plugin file from Release and unzip it into your Obsidian plugin directory.</li>
|
|
||||||
<li>Re-open Obsidian, go to settings, and enable the plugin.</li>
|
|
||||||
<li>In the settings, find Obsidian to NotionNext, and enter your NotionNext Database ID and API token.</li>
|
|
||||||
</ol>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="how-to-use-1" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="how-to-use-1">How to Use</h3>
|
|
||||||
</section>
|
|
||||||
<section id="using-the-plugin" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="using-the-plugin">Using the Plugin</h3>
|
|
||||||
<p>In the repository, I have uploaded a template which you can directly copy into your template folder. After that, use Obsidian’s template feature to create a new note with one click.</p>
|
|
||||||
<p>If you don’t want to use the template, you can also directly create a new file in Obsidian and then copy the content below. Then save it.</p>
|
|
||||||
<div class="sourceCode" id="cb1"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co"># default value has been set.</span></span>
|
|
||||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co"># for any unwanted value, you can delete it or set it to empty.</span></span>
|
|
||||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co"># for example, if you donot want to set password, you can delete password: "1234" or set it to password: ""</span></span>
|
|
||||||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co"># 我已经在插件中设置了默认值,如果有不需要的选项,可以直接删除。</span></span>
|
|
||||||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="co"># 例如你不需要密码选项,你可以将password: "1234"删除,或者将它设置为空。</span></span>
|
|
||||||
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="co"># !!!!!!!!!!!!</span></span>
|
|
||||||
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="co"># 现在阶段一定不要修改表头的名字, please do not change the name of the header in YAML front matter</span></span>
|
|
||||||
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="co"># !!!!!!!!!!!!</span></span>
|
|
||||||
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a><span class="an">titleicon:</span><span class="co"> 📎 # emoji icon, default is 📜, 默认是📜</span></span>
|
|
||||||
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="an">date:</span><span class="co"> 2023-07-23 # default is today, 默认是今天。 Format is YYYY-MM-DD, 格式是YYYY-MM-DD</span></span>
|
|
||||||
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="an">coverurl:</span><span class="co"> https://img.jxpeng.dev/2023/08/843e27a210847f05a0f7cfb121fec100.jpg # default is empty, 默认是空</span></span>
|
|
||||||
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a><span class="an">type:</span><span class="co"> Post # Post or Page, default is Post, 默认是Post</span></span>
|
|
||||||
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a><span class="an">slug:</span><span class="co"> test # slug for url, default is empty, 默认是空</span></span>
|
|
||||||
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a><span class="an">stats:</span><span class="co"> Draft # Draft, Invisible, Published, default is Draft, 默认是Draft</span></span>
|
|
||||||
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a><span class="an">category:</span><span class="co"> test # default is 'Obsidian', 默认是'Obsidian'</span></span>
|
|
||||||
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a><span class="an">summary:</span><span class="co"> this is a summary for test post # default is empty, 默认是空</span></span>
|
|
||||||
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a><span class="an">icon:</span><span class="co"> fa-solid fa-camera # you can ignore this, default is empty, 默认是空,可直接删除</span></span>
|
|
||||||
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a><span class="an">password:</span><span class="co"> "1234" # if you donot want to set password, you can delete this line, default is empty, 默认是空,可直接删除</span></span>
|
|
||||||
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a><span class="co"># 现在必须开启tags选项,否则会报错</span></span>
|
|
||||||
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a><span class="an">tags:</span></span>
|
|
||||||
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a><span class="co"> - test # tags for post</span></span>
|
|
||||||
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a><span class="co"> - web # add more tags if you want</span></span>
|
|
||||||
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a>Contents Below</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|
||||||
<p>Usage of the template is as follows: <img src="https://minioapi.pjx.ac.cn/img1/2023/09/354b950e5777b48832c2475e4a31f2cc.gif" class="img-fluid"></p>
|
|
||||||
<p><strong>Plugin preview is shown below</strong> <img src="https://minioapi.pjx.ac.cn/img1/2023/09/d6199619b68fab218fca8ae0cebece78.gif" class="img-fluid"></p>
|
|
||||||
<hr>
|
|
||||||
<p><strong>Original README.md</strong></p>
|
|
||||||
<p>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 <a href="https://github.com/EasyChris/obsidian-to-notion">original author</a> a star.</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="obsidian-to-notion" class="level1">
|
|
||||||
<h1>Obsidian to Notion</h1>
|
|
||||||
<p><a href="https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml"><img src="https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml/badge.svg" class="img-fluid"></a> <a href="https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml"><img src="https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml/badge.svg" class="img-fluid" alt="Release Obsidian plugin"></a> <a href="https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/master/LICENSE"><img src="https://img.shields.io/github/license/EasyChris/obsidian-to-notion.png" class="img-fluid" alt="GitHub license"></a> <a href="https://GitHub.com/Easychris/obsidian-to-notion/releases/"><img src="https://img.shields.io/github/downloads/Easychris/obsidian-to-notion/total.svg" class="img-fluid" alt="Github all releases"></a> <a href="https://github.com/Easychris/obsidian-to-notion/releases"><img src="https://badgen.net/github/release/Easychris/obsidian-to-notion/.png" class="img-fluid" alt="GitLab latest release"></a></p>
|
|
||||||
<p>Share of obsidian to Notion <a href="README-zh.md">中文文档</a></p>
|
|
||||||
<p>Sharing files from Obsidian to Notion with a single click, and Obsidian will automatically add the Notion share link</p>
|
|
||||||
<p>You are welcome to offer it a star if it can benefit you.</p>
|
|
||||||
<p><img src="./doc/1.gif" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="todo" class="level1">
|
|
||||||
<h1>TODO</h1>
|
|
||||||
<section id="todo-board" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="todo-board"><a href="https://github.com/users/EasyChris/projects/3/views/1">TODO Board</a></h3>
|
|
||||||
<ul class="task-list">
|
|
||||||
<li><input type="checkbox" checked="">support for custom page banner</li>
|
|
||||||
<li><input type="checkbox" checked="">update the exsit page</li>
|
|
||||||
<li><input type="checkbox" checked="">support for mult language</li>
|
|
||||||
<li><input type="checkbox" checked="">support for auto copy the share link to clipboard</li>
|
|
||||||
<li><input type="checkbox" checked="">support for mobile</li>
|
|
||||||
<li><input type="checkbox" checked="">support tags thank for <a href="https://github.com/jannikbuscha"><span class="citation" data-cites="jannikbuscha">@jannikbuscha</span></a></li>
|
|
||||||
<li><input type="checkbox">transfer the bi-link format like [[]] into the format that Notion supports.</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="how-to-use-2" class="level1">
|
|
||||||
<h1>How to use</h1>
|
|
||||||
<section id="install-the-plugin" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="install-the-plugin">Install the plugin</h2>
|
|
||||||
<section id="marketplace-download" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="marketplace-download">Marketplace download</h3>
|
|
||||||
<p>Open obsidian setting -> Add plugin -> Search -> notion</p>
|
|
||||||
<p><img src="https://afox-1256168983.cos.ap-shanghai.myqcloud.com/20220628214145.png" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="brat" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="brat">BRAT</h3>
|
|
||||||
<p>Enter <code>BRAT</code> into the plugin market center to find it. Add <code>EasyChris/obsidian-to-notion</code> to the list of BRAT plugins that have been installed. Return to the plugin center and turn it on.</p>
|
|
||||||
</section>
|
|
||||||
<section id="manual-installation" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="manual-installation">Manual installation</h3>
|
|
||||||
<pre><code>cd YOUR_OBSIDIAN_FOLDER/.obsidian/plugins/
|
|
||||||
git clone https://github.com/EasyChris/obsidian-to-notion.git</code></pre>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="apply-notion-api" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="apply-notion-api">Apply Notion API</h2>
|
|
||||||
<p>Official reference documentation: <a href="https://developers.notion.com/docs">https://developers.notion.com/docs</a></p>
|
|
||||||
<section id="step-1-create-integration" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="step-1-create-integration">Step 1: Create integration</h3>
|
|
||||||
<p>Go to <a href="https://www.notion.com/my-integrations">https://www.notion.com/my-integrations</a> Once created, copy <code>secrets toekn</code> <img src="https://files.readme.io/2ec137d-093ad49-create-integration.gif" class="img-fluid"></p>
|
|
||||||
<section id="note" class="level4">
|
|
||||||
<h4 class="anchored" data-anchor-id="note">Note</h4>
|
|
||||||
<p>database first custom name must be “Name”, otherwise sync to notion will be failed</p>
|
|
||||||
<p><img src="https://afox-1256168983.cos.ap-shanghai.myqcloud.com/20220618102029.png" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="step-2-share-a-database-with-your-integration" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="step-2-share-a-database-with-your-integration">Step 2: Share a database with your integration</h3>
|
|
||||||
<p>Create a new page (with public permissions) Create a new database in the page -> you need <code>full page database</code> <img src="./doc/3.gif" class="img-fluid"></p>
|
|
||||||
<p>Add <code>integration</code> to your new database</p>
|
|
||||||
<p><img src="./doc/6.gif" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="step-3-copy-the-database-id" class="level3">
|
|
||||||
<h3 class="anchored" data-anchor-id="step-3-copy-the-database-id">Step 3: Copy the database ID</h3>
|
|
||||||
<pre><code>https://www.notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=...
|
|
||||||
| --------- Database ID --------|
|
|
||||||
</code></pre>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="open-the-plugin-configuration" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="open-the-plugin-configuration">Open the plugin configuration</h2>
|
|
||||||
<p>Fill the configuration with the <code>NOTION_API_KEY</code> and <code>DATABASE_ID</code> you got <img src="./doc/2.png" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="upload-file-content-to-notion" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="upload-file-content-to-notion">Upload file content to notion</h2>
|
|
||||||
<p>Click the uploadCommand notion button <img src="./doc/4.png" class="img-fluid"> A share link will be automatically generated after successful uploadCommand <img src="./doc/5.png" class="img-fluid"></p>
|
|
||||||
</section>
|
|
||||||
<section id="banner-url-option" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="banner-url-option">Banner URL [option]</h2>
|
|
||||||
<p>Banner url must be a image url like: <a href="https://i.imgur.com/xxx.jpg" class="uri">https://i.imgur.com/xxx.jpg</a> If you don’t want to use banner, leave it blank</p>
|
|
||||||
</section>
|
|
||||||
<section id="convert-tags-option" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="convert-tags-option">Convert Tags [option]</h2>
|
|
||||||
<p>Transfer the Obsidian tags to the Notion table. It requires the column with the name ‘Tags’. <img src="./doc/7.png" class="img-fluid"></p>
|
|
||||||
<p>Add tags to your notion page</p>
|
|
||||||
<p><img src="./doc/10.png" class="img-fluid"></p>
|
|
||||||
<ul>
|
|
||||||
<li>open plugin convert tags</li>
|
|
||||||
</ul>
|
|
||||||
<p><img src="./doc/8.png" class="img-fluid"></p>
|
|
||||||
<ul>
|
|
||||||
<li>add tags in the head</li>
|
|
||||||
</ul>
|
|
||||||
<div class="sourceCode" id="cb4"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="an">tags:</span><span class="co"> [tag1,tag2]</span></span>
|
|
||||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a>this is test tags</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|
||||||
<div class="sourceCode" id="cb5"><pre class="sourceCode markdown code-with-copy"><code class="sourceCode markdown"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="an">tags:</span></span>
|
|
||||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="co"> - tag4</span></span>
|
|
||||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
|
|
||||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a>this is test tags</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
|
||||||
<p><img src="./doc/9.png" class="img-fluid"></p>
|
|
||||||
<p>Thanks for <a href="https://github.com/jannikbuscha"><span class="citation" data-cites="jannikbuscha">@jannikbuscha</span></a> contribution</p>
|
|
||||||
</section>
|
|
||||||
<section id="notion-id-option" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="notion-id-option">Notion ID [option]</h2>
|
|
||||||
<p>Notion ID is the your notion site ID that you want to share the file to. if you don’t write it, notion will share to the default link like: <a href="https://www.notion.so/myworkspace/a8aec43384f447ed84390" class="uri">https://www.notion.so/myworkspace/a8aec43384f447ed84390</a> that visit this page need to redirect to your site url if you write the Notion ID, it will share to the page link like: <a href="https://your_user_name.notion.site/myworkspace/a8aec43384f447ed84390" class="uri">https://your_user_name.notion.site/myworkspace/a8aec43384f447ed84390</a>. The visiter don’t need to redirect url.</p>
|
|
||||||
</section>
|
|
||||||
<section id="sync-image-to-notion" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="sync-image-to-notion">Sync image to Notion</h2>
|
|
||||||
<p>To sync images to your oss or cos bucket, use the <a href="https://github.com/renmu123/obsidian-image-auto-upload-plugin">Obsidian Image Auto Upload Plugin</a>.</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="development" class="level1">
|
|
||||||
<h1>Development</h1>
|
|
||||||
<pre><code>git clone https://github.com/EasyChris/obsidian-to-notion.git
|
|
||||||
yarn install
|
|
||||||
yarn dev</code></pre>
|
|
||||||
<section id="release" class="level2">
|
|
||||||
<h2 class="anchored" data-anchor-id="release">Release</h2>
|
|
||||||
<pre><code>node update-version.js
|
|
||||||
./release.sh</code></pre>
|
|
||||||
<p>```</p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
<section id="thanks" class="level1">
|
|
||||||
<h1>Thanks</h1>
|
|
||||||
<p><a href="https://luhaifeng666.github.io/obsidian-plugin-docs-zh/zh/getting-started/development-workflow.html">Development Process | Obsidian Plugin Development Documentation</a></p>
|
|
||||||
<p><a href="https://github.com/devbean/obsidian-wordpress">GitHub - devbean/obsidian-wordpress: An obsidian plugin for publishing docs to WordPress.</a></p>
|
|
||||||
<p><a href="https://github.com/obsidianmd/obsidian-api">GitHub - obsidianmd/obsidian-api</a></p>
|
|
||||||
<p><a href="https://github.dev/zhaohongxuan/obsidian-weread-plugin">GitHub - Easychris/obsidian-to-notion: Obsidian Weread Plugin is an plugin to sync Weread(微信读书) hightlights and annotations into your Obsidian Vault.</a></p>
|
|
||||||
<p><a href="https://github.com/Quorafind/Obsidian-Memos">GitHub - Quorafind/Obsidian-Memos: A quick capture plugin for Obsidian, all data from your notes.</a></p>
|
|
||||||
<p><a href="https://github.com/jannikbuscha">https://github.com/jannikbuscha/obsidian-to-notion</a></p>
|
|
||||||
</section>
|
|
||||||
<section id="license" class="level1">
|
|
||||||
<h1>License</h1>
|
|
||||||
<p>GNU GPLv3</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
<!-- /main column -->
|
|
||||||
<script id="quarto-html-after-body" type="application/javascript">
|
|
||||||
window.document.addEventListener("DOMContentLoaded", function (event) {
|
|
||||||
const toggleBodyColorMode = (bsSheetEl) => {
|
|
||||||
const mode = bsSheetEl.getAttribute("data-mode");
|
|
||||||
const bodyEl = window.document.querySelector("body");
|
|
||||||
if (mode === "dark") {
|
|
||||||
bodyEl.classList.add("quarto-dark");
|
|
||||||
bodyEl.classList.remove("quarto-light");
|
|
||||||
} else {
|
|
||||||
bodyEl.classList.add("quarto-light");
|
|
||||||
bodyEl.classList.remove("quarto-dark");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const toggleBodyColorPrimary = () => {
|
|
||||||
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
|
||||||
if (bsSheetEl) {
|
|
||||||
toggleBodyColorMode(bsSheetEl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toggleBodyColorPrimary();
|
|
||||||
const icon = "";
|
|
||||||
const anchorJS = new window.AnchorJS();
|
|
||||||
anchorJS.options = {
|
|
||||||
placement: 'right',
|
|
||||||
icon: icon
|
|
||||||
};
|
|
||||||
anchorJS.add('.anchored');
|
|
||||||
const isCodeAnnotation = (el) => {
|
|
||||||
for (const clz of el.classList) {
|
|
||||||
if (clz.startsWith('code-annotation-')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
|
||||||
text: function(trigger) {
|
|
||||||
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
|
||||||
for (const childEl of codeEl.children) {
|
|
||||||
if (isCodeAnnotation(childEl)) {
|
|
||||||
childEl.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return codeEl.innerText;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
clipboard.on('success', function(e) {
|
|
||||||
// button target
|
|
||||||
const button = e.trigger;
|
|
||||||
// don't keep focus
|
|
||||||
button.blur();
|
|
||||||
// flash "checked"
|
|
||||||
button.classList.add('code-copy-button-checked');
|
|
||||||
var currentTitle = button.getAttribute("title");
|
|
||||||
button.setAttribute("title", "Copied!");
|
|
||||||
let tooltip;
|
|
||||||
if (window.bootstrap) {
|
|
||||||
button.setAttribute("data-bs-toggle", "tooltip");
|
|
||||||
button.setAttribute("data-bs-placement", "left");
|
|
||||||
button.setAttribute("data-bs-title", "Copied!");
|
|
||||||
tooltip = new bootstrap.Tooltip(button,
|
|
||||||
{ trigger: "manual",
|
|
||||||
customClass: "code-copy-button-tooltip",
|
|
||||||
offset: [0, -8]});
|
|
||||||
tooltip.show();
|
|
||||||
}
|
|
||||||
setTimeout(function() {
|
|
||||||
if (tooltip) {
|
|
||||||
tooltip.hide();
|
|
||||||
button.removeAttribute("data-bs-title");
|
|
||||||
button.removeAttribute("data-bs-toggle");
|
|
||||||
button.removeAttribute("data-bs-placement");
|
|
||||||
}
|
|
||||||
button.setAttribute("title", currentTitle);
|
|
||||||
button.classList.remove('code-copy-button-checked');
|
|
||||||
}, 1000);
|
|
||||||
// clear code selection
|
|
||||||
e.clearSelection();
|
|
||||||
});
|
|
||||||
function tippyHover(el, contentFn) {
|
|
||||||
const config = {
|
|
||||||
allowHTML: true,
|
|
||||||
content: contentFn,
|
|
||||||
maxWidth: 500,
|
|
||||||
delay: 100,
|
|
||||||
arrow: false,
|
|
||||||
appendTo: function(el) {
|
|
||||||
return el.parentElement;
|
|
||||||
},
|
|
||||||
interactive: true,
|
|
||||||
interactiveBorder: 10,
|
|
||||||
theme: 'quarto',
|
|
||||||
placement: 'bottom-start'
|
|
||||||
};
|
|
||||||
window.tippy(el, config);
|
|
||||||
}
|
|
||||||
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
|
||||||
for (var i=0; i<noterefs.length; i++) {
|
|
||||||
const ref = noterefs[i];
|
|
||||||
tippyHover(ref, function() {
|
|
||||||
// use id or data attribute instead here
|
|
||||||
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
|
||||||
try { href = new URL(href).hash; } catch {}
|
|
||||||
const id = href.replace(/^#\/?/, "");
|
|
||||||
const note = window.document.getElementById(id);
|
|
||||||
return note.innerHTML;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let selectedAnnoteEl;
|
|
||||||
const selectorForAnnotation = ( cell, annotation) => {
|
|
||||||
let cellAttr = 'data-code-cell="' + cell + '"';
|
|
||||||
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
|
||||||
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
|
||||||
return selector;
|
|
||||||
}
|
|
||||||
const selectCodeLines = (annoteEl) => {
|
|
||||||
const doc = window.document;
|
|
||||||
const targetCell = annoteEl.getAttribute("data-target-cell");
|
|
||||||
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
|
||||||
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
|
||||||
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
|
||||||
const lineIds = lines.map((line) => {
|
|
||||||
return targetCell + "-" + line;
|
|
||||||
})
|
|
||||||
let top = null;
|
|
||||||
let height = null;
|
|
||||||
let parent = null;
|
|
||||||
if (lineIds.length > 0) {
|
|
||||||
//compute the position of the single el (top and bottom and make a div)
|
|
||||||
const el = window.document.getElementById(lineIds[0]);
|
|
||||||
top = el.offsetTop;
|
|
||||||
height = el.offsetHeight;
|
|
||||||
parent = el.parentElement.parentElement;
|
|
||||||
if (lineIds.length > 1) {
|
|
||||||
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
|
||||||
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
|
||||||
height = bottom - top;
|
|
||||||
}
|
|
||||||
if (top !== null && height !== null && parent !== null) {
|
|
||||||
// cook up a div (if necessary) and position it
|
|
||||||
let div = window.document.getElementById("code-annotation-line-highlight");
|
|
||||||
if (div === null) {
|
|
||||||
div = window.document.createElement("div");
|
|
||||||
div.setAttribute("id", "code-annotation-line-highlight");
|
|
||||||
div.style.position = 'absolute';
|
|
||||||
parent.appendChild(div);
|
|
||||||
}
|
|
||||||
div.style.top = top - 2 + "px";
|
|
||||||
div.style.height = height + 4 + "px";
|
|
||||||
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
|
||||||
if (gutterDiv === null) {
|
|
||||||
gutterDiv = window.document.createElement("div");
|
|
||||||
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
|
||||||
gutterDiv.style.position = 'absolute';
|
|
||||||
const codeCell = window.document.getElementById(targetCell);
|
|
||||||
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
|
||||||
gutter.appendChild(gutterDiv);
|
|
||||||
}
|
|
||||||
gutterDiv.style.top = top - 2 + "px";
|
|
||||||
gutterDiv.style.height = height + 4 + "px";
|
|
||||||
}
|
|
||||||
selectedAnnoteEl = annoteEl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const unselectCodeLines = () => {
|
|
||||||
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
|
||||||
elementsIds.forEach((elId) => {
|
|
||||||
const div = window.document.getElementById(elId);
|
|
||||||
if (div) {
|
|
||||||
div.remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
selectedAnnoteEl = undefined;
|
|
||||||
};
|
|
||||||
// Attach click handler to the DT
|
|
||||||
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
|
||||||
for (const annoteDlNode of annoteDls) {
|
|
||||||
annoteDlNode.addEventListener('click', (event) => {
|
|
||||||
const clickedEl = event.target;
|
|
||||||
if (clickedEl !== selectedAnnoteEl) {
|
|
||||||
unselectCodeLines();
|
|
||||||
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
|
||||||
if (activeEl) {
|
|
||||||
activeEl.classList.remove('code-annotation-active');
|
|
||||||
}
|
|
||||||
selectCodeLines(clickedEl);
|
|
||||||
clickedEl.classList.add('code-annotation-active');
|
|
||||||
} else {
|
|
||||||
// Unselect the line
|
|
||||||
unselectCodeLines();
|
|
||||||
clickedEl.classList.remove('code-annotation-active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const findCites = (el) => {
|
|
||||||
const parentEl = el.parentElement;
|
|
||||||
if (parentEl) {
|
|
||||||
const cites = parentEl.dataset.cites;
|
|
||||||
if (cites) {
|
|
||||||
return {
|
|
||||||
el,
|
|
||||||
cites: cites.split(' ')
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return findCites(el.parentElement)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
|
||||||
for (var i=0; i<bibliorefs.length; i++) {
|
|
||||||
const ref = bibliorefs[i];
|
|
||||||
const citeInfo = findCites(ref);
|
|
||||||
if (citeInfo) {
|
|
||||||
tippyHover(citeInfo.el, function() {
|
|
||||||
var popup = window.document.createElement('div');
|
|
||||||
citeInfo.cites.forEach(function(cite) {
|
|
||||||
var citeDiv = window.document.createElement('div');
|
|
||||||
citeDiv.classList.add('hanging-indent');
|
|
||||||
citeDiv.classList.add('csl-entry');
|
|
||||||
var biblioDiv = window.document.getElementById('ref-' + cite);
|
|
||||||
if (biblioDiv) {
|
|
||||||
citeDiv.innerHTML = biblioDiv.innerHTML;
|
|
||||||
}
|
|
||||||
popup.appendChild(citeDiv);
|
|
||||||
});
|
|
||||||
return popup.innerHTML;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div> <!-- /content -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body></html>
|
|
||||||
436
README.md
436
README.md
@@ -2,195 +2,262 @@
|
|||||||
|
|
||||||
[](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml)
|
[](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/test.yml)
|
||||||
[](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml)
|
[](https://github.com/jxpeng98/obsidian-to-NotionNext/actions/workflows/release.yml)
|
||||||
[](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/)
|
[](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/)
|
||||||
[](https://github.com/jxpeng98/obsidian-to-NotionNext/releases)
|
[](https://github.com/jxpeng98/obsidian-to-NotionNext/releases/)
|
||||||
|
|
||||||
[中文文档](README-zh.md)
|
[//]: # ([](https://GitHub.com/jxpeng98/obsidian-to-NotionNext/releases/))
|
||||||
|
|
||||||
|
[//]: # ([中文文档](README-zh.md))
|
||||||
|
|
||||||
|
**Now, support both NotionNext and General databases with customised properties.**
|
||||||
|
|
||||||
|
**现在支持NotionNext和普通Notion数据库,可自定义数据库列表。**
|
||||||
|
|
||||||
|
## Precautions
|
||||||
|
|
||||||
|
### For customised database users
|
||||||
|
|
||||||
|
**⚠️⚠️⚠️: The existing customised database should be recreated if you want to update to version 2.3.0. The new version has a new database structure, and the old database structure is not compatible with the new version to build the index properly.**
|
||||||
|
|
||||||
|
### 自定义数据库用户
|
||||||
|
|
||||||
|
**⚠️⚠️⚠️: 如果你想要更新到2.3.0版本,你需要重新创建自定义数据库。新版本有一个新的数据库结构,旧的数据库结构无法构建索引。**
|
||||||
|
|
||||||
|
## TODO List
|
||||||
|
|
||||||
|
- [x] ~~Modify the Edit function for the custom properties. 改进自定义属性的编辑功能~~
|
||||||
|
- [ ] 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 edit for database details in plugin settings. 支持编辑数据库详情~~
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
If you want to use this plugin, you need to follow the following steps to set up the plugin. The steps can be divided into two parts: setting up the Notion API and setting up the plugin in Obsidian.
|
||||||
|
|
||||||
|
### 1. Setting up the Notion API
|
||||||
|
|
||||||
|
1). Go to [Notion API](https://www.notion.com/my-integrations) to create a new integration, and **copy the token**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
2). Create a database in your Notion workspace.
|
||||||
|
|
||||||
|
Open Notion, click top-left `Create` a new page` -> You can give a title for the page and press "/" Select 'Database - Full page'.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Rename the database properties to `title` and `tags`.
|
||||||
|
**⚠️⚠️`title` is the title column! `tags` is lower case⚠️⚠️**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3). Add the Notion API integration.
|
||||||
|
|
||||||
|
Click the right-top '...' -> connections -> connect to -> find the integration you created and connect it.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
4). Publish the database to the public.
|
||||||
|
Click the 'Share' -> 'Publish' -> 'Publish' -> **copy the database id from the URL**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2. Setting up the plugin in Obsidian
|
||||||
|
|
||||||
|
1). Go to Obsidian settings -> community plugins -> search 'NotionNext' -> install it.
|
||||||
|

|
||||||
|
|
||||||
|
2). Open the plugin settings and create a new database.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 3. Create a database
|
||||||
|
|
||||||
|
**You can create three types of databases:**
|
||||||
|
|
||||||
|
#### 1️⃣ General database
|
||||||
|
|
||||||
|
General database is the default database, which only has the `title` and `tags` columns. **⚠️⚠️`title` and `tags` are lowercase⚠️⚠️**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The general is as follows:
|
||||||
|
|
||||||
|
- Full Name: the full name that you would like to give to the database.
|
||||||
|
- Abbreviate Name: the abbreviation that you would like to give to the database.
|
||||||
|
- Notion tags sync: whether you want to sync the tags column to Notion.
|
||||||
|
- Customise title property: whether you want to change the `title` to another name (e.g., `name`).
|
||||||
|
- Notion API token: the token you copied from the Notion API page.
|
||||||
|
- Notion Database ID: the database ID you copied from the Notion database URL. (e.g., only copy `7158cd3f70ce4f60afd9da5bdf74fd0c` between `site/` and `?`. `https://jxpeng.notion.site/7158cd3f70ce4f60afd9da5bdf74fd0c?v=380317ac5373sadasdas3c13e618f&pvs=4**`)
|
||||||
|
|
||||||
|
After setting, it should look like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Once you click `save`, the new database will be created in the plugin settings and display in the detabase list.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### 2️⃣ NotionNext database
|
||||||
|
|
||||||
|
If you use [NotionNext](https://github.com/tangly1024/NotionNext) to set up your website, you can use the NotionNext database. (**All the properties are in lowercase, and you do not need to change the properties**)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Like the general database, you need to fill in the following information:
|
||||||
|
|
||||||
|
- Full Name: the full name that you would like to give to the database.
|
||||||
|
- Abbreviate Name: the abbreviation that you would like to give to the database.
|
||||||
|
- Notion API token: the token you copied from the Notion API page.
|
||||||
|
- Notion Database ID: the database ID you copied from the Notion database URL.
|
||||||
|
|
||||||
|
#### 3️⃣ Custom database
|
||||||
|
|
||||||
|
The custom database is purely customised, and you can customise the properties you want to sync. (**All the properties are in lowercase, and you do not need to change the properties**)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The basic information is identical to the general database and NotionNext database. You need to fill in the following information:
|
||||||
|
|
||||||
|
- Full Name: the full name that you would like to give to the database.
|
||||||
|
- Abbreviate Name: the abbreviation that you would like to give to the database.
|
||||||
|
- Notion API token: the token you copied from the Notion API page.
|
||||||
|
- Notion Database ID: the database ID you copied from the Notion database URL.
|
||||||
|
|
||||||
|
After adding the information, You can click `Add New Property` to add the properties you want to sync. There is no limit to the number of properties you can add.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**⚠️⚠️⚠️**: **`Title column` is the main property in the Notion database, which has the open button to open the underlying page.** You can select the type of all other properties. **⚠️⚠️⚠️**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
According to the previously shown database, you can use `title` as the `Title column`, and `Tags` as the property 1.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Until now, you have set up the plugin in Obsidian. You can start syncing your notes to Notion.**
|
||||||
|
|
||||||
|
### 4. Start syncing
|
||||||
|
|
||||||
|
Create a new note in Obsidian, and fill in the front matter with the properties you want to sync.
|
||||||
|
|
||||||
|
#### 1️⃣ note for general database
|
||||||
|
|
||||||
|
For example, we can create a test note with the following front matter:
|
||||||
|
|
||||||
|
``` markdown
|
||||||
|
---
|
||||||
|
title: test
|
||||||
|
tags: [test, web]
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a test file.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
After creating the note, you can click the `Share to NotionNext` button on the left sidebar to sync the note to Notion.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### 2️⃣ note for NotionNext database
|
||||||
|
|
||||||
|
We use the following front matter for the NotionNext database:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
title: test-notionnext
|
||||||
|
titleicon: 📎
|
||||||
|
date: 2023-07-23
|
||||||
|
coverurl: https://img.jxpeng.dev/2023/08/843e27a210847f05a0f7cfb121fec100.jpg
|
||||||
|
type: Post
|
||||||
|
slug: test
|
||||||
|
status: Draft
|
||||||
|
category: test
|
||||||
|
summary: this is a summary for test post
|
||||||
|
icon: fa-solid fa-camera
|
||||||
|
password: "1234"
|
||||||
|
tags:
|
||||||
|
- test
|
||||||
|
- web
|
||||||
|
NotionID-pengjiaxin: 8ba573de-8fdf-4681-b063-c39d26e7860e
|
||||||
|
---
|
||||||
|
|
||||||
|
this is a test file
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### 3️⃣ note for custom database
|
||||||
|
|
||||||
|
##### sync title and tags
|
||||||
|
|
||||||
|
Use the previously created general database and rename `title` to `Name` and `tags` to `Tags` in Notion.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The front matter for the custom database is as follows:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
Name: test-custom
|
||||||
|
Tags:
|
||||||
|
- test
|
||||||
|
- web
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a test file.
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
##### sync more properties
|
||||||
|
|
||||||
|
Add more property to the custom database. For example, we can add a `summary` and `date` property to the custom database.
|
||||||
|
|
||||||
|
1). Click `Edit` in the plugin settings.
|
||||||
|

|
||||||
|
2). Click `Add` and add the `summary` and `date` property.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3). After adding the properties, you can see the properties in the plugin settings.
|
||||||
|

|
||||||
|
4). Add the `summary` and `date` in Notion
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
5). Create a new note with the `summary` and `date` property.
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
Name: test-custom-more
|
||||||
|
Tags:
|
||||||
|
- test
|
||||||
|
- web
|
||||||
|
summary: this is a summary for test custom
|
||||||
|
date: 2022-05-03
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a test file.
|
||||||
|
```
|
||||||
|
|
||||||
|
6). Sync the note to Notion.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Acknowledgment
|
||||||
|
|
||||||
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.
|
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.
|
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.**
|
|
||||||
|
|
||||||
## Update
|
|
||||||
### 1.1.1
|
|
||||||
- Fix the setting display bug in Japanese.
|
|
||||||
- Add Japanese translation.
|
|
||||||
|
|
||||||
### 1.1.0
|
|
||||||
- Fix the custom name setting tab display bug.
|
|
||||||
- Add a toggle to control whether to sync `tags` since the empty tags may cause the syncing error.
|
|
||||||
|
|
||||||
If you switch off the `tags` function in the plugin settings, it will ignore the `tags` in your frontmatter.
|
|
||||||
|
|
||||||
If you prefer to sync tags to Notion database, you can switch on the `tags` function in the plugin settings. **You can only use the following format for tags:**
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
tags: #empty tags, option 1
|
|
||||||
tags: [test,test1,test2] # use the square brackets, option 2
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
- test1
|
|
||||||
- test2 # use the dash option 3
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.0.1
|
|
||||||
|
|
||||||
- Fix the custom name element display bug in the settings.
|
|
||||||
|
|
||||||
### 1.0.0 (Big Update)
|
|
||||||
|
|
||||||
- From this version, you can **modify the first column name (title column, default: 'title')** as you want. (**Note: You need to have the 'tags' column in your Notion General database, and add `tags:` in your markdown frontmatter. If not, you will receive `network error 400`. But you can leave the `tags:` blank.**)
|
|
||||||
|
|
||||||

|
|
||||||
Like this:
|
|
||||||

|
|
||||||
|
|
||||||
- Add a switch button to control whether display the setting tabs in the plugin settings for both NotionNext and Notion General databases.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 0.2.6
|
|
||||||
|
|
||||||
- Add a switch button to control whether to show the upload command in the command palette.
|
|
||||||
|
|
||||||
<!-- 
|
|
||||||
If you turn off the button for the General database, you won't see the option for the General database in the upload command list.
|
|
||||||
|
|
||||||
If you turn off the button for the NotionNext database, you won't see the option for the NotionNext database in the upload command list.
|
|
||||||
|
|
||||||
 -->
|
|
||||||
|
|
||||||
### 0.2.3
|
|
||||||
|
|
||||||
- Fix the bug, now you can update normally.
|
|
||||||
|
|
||||||
### 0.2.2
|
|
||||||
|
|
||||||
- Support both NotionNext and General Notion database.
|
|
||||||
- You can have one NotionNext and one General Notion database.
|
|
||||||
- General Notion database can only have `title` and `tags` columns, and `tags` columns should be the multi-selected property. **the name of the columns is case sensitive. You should use small letter.**
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 0.2.1
|
|
||||||
|
|
||||||
- Restructure the code
|
|
||||||
|
|
||||||
### 0.2.0
|
|
||||||
|
|
||||||
- From this version, the interactive logic has been rewritten. When you click the ribbon icon, it will display the sync command for all presetting NotionNext databases. You can choose the database you want to sync to. **However, only NotionNext database is supported for now.**
|
|
||||||
|
|
||||||
### 0.1.10
|
|
||||||
|
|
||||||
- Fix the Chinese support in the settings.
|
|
||||||
|
|
||||||
### 0.1.8
|
|
||||||
|
|
||||||
- Rebuild the uploadCommand function, and add one button to select the different databases. **However, only NotionNext database is supported for now.**
|
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
## How to Use
|
|
||||||
|
|
||||||
### Precautions
|
|
||||||
|
|
||||||
For now, this plugin is exclusively for [NotionNext](https://github.com/tangly1024/NotionNext). If you're not using this template, you'll keep receiving `error 400`.
|
|
||||||
|
|
||||||
For those without a NotionNext requirement, please use the original [Obsidian-to-notion](https://github.com/EasyChris/obsidian-to-notion).
|
|
||||||
|
|
||||||
### Pre-Installation Steps
|
|
||||||
|
|
||||||
Before installing the plugin, you must have set up the following:
|
|
||||||
|
|
||||||
1. Your NotionNext database.
|
|
||||||
2. According to the original author's readme.md, set up the Notion API, and it should already be associated with your NotionNext repository.
|
|
||||||
3. NotionNext Database ID
|
|
||||||
4. Your NotionNext database should have the following contents:
|
|
||||||
- type
|
|
||||||
- title
|
|
||||||
- slug
|
|
||||||
- category
|
|
||||||
- tags
|
|
||||||
- date
|
|
||||||
- status
|
|
||||||
- summary
|
|
||||||
- password
|
|
||||||
- icon
|
|
||||||
|
|
||||||
From version 0.0.6, I also add the following contents:
|
|
||||||
- titleicon: the unique icon for each post, it can only support emoji currently.
|
|
||||||
- cover url: the cover image for each post, it should be end with a type of image, such as .jpg, .png, .gif, etc.
|
|
||||||
|
|
||||||
**If you've directly copied the NotionNext template, these contents should already exist. I've made changes to this plugin based on the original author's work. All you need to ensure is that your database has the above content, and every letter is in lowercase!!!**
|
|
||||||
|
|
||||||
**⚠️⚠️⚠️: All headers are in lowercase!!! The order doesn't matter!**
|
|
||||||
|
|
||||||
### Plugin Installation
|
|
||||||
|
|
||||||
#### Install via Community Plugins
|
|
||||||
|
|
||||||
Open `Obsidian settings -> Community Plugins -> Browse -> NotionNext -> Share to NotionNext`
|
|
||||||
|
|
||||||
#### Mannually Install
|
|
||||||
|
|
||||||
1. Close Obsidian.
|
|
||||||
2. Download the plugin file from Release and unzip it into your Obsidian plugin directory.
|
|
||||||
3. Re-open Obsidian, go to settings, and enable the plugin.
|
|
||||||
4. In the settings, find Obsidian to NotionNext, and enter your NotionNext Database ID and API token.
|
|
||||||
|
|
||||||
### How to Use
|
|
||||||
|
|
||||||
### Using the Plugin
|
|
||||||
|
|
||||||
In the repository, I have uploaded a template which you can directly copy into your template folder. After that, use Obsidian's template feature to create a new note with one click.
|
|
||||||
|
|
||||||
If you don't want to use the template, you can also directly create a new file in Obsidian and then copy the content below. Then save it.
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
# 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, 默认是空
|
|
||||||
stats: 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
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Contents Below
|
<details> <summary> Original README.md </summary>
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Usage of the template is as follows:
|
|
||||||

|
|
||||||
|
|
||||||
**Plugin preview is shown below**
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Original README.md**
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
@@ -364,10 +431,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)
|
||||||
@@ -384,3 +447,6 @@ node update-version.js
|
|||||||
|
|
||||||
# License
|
# License
|
||||||
GNU GPLv3
|
GNU GPLv3
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const ctx = await esbuild.context({
|
|||||||
"@codemirror/view",
|
"@codemirror/view",
|
||||||
...builtins,
|
...builtins,
|
||||||
],
|
],
|
||||||
|
platform: "node",
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
target: "es2016",
|
target: "es2016",
|
||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "share-to-notionnext",
|
"id": "share-to-notionnext",
|
||||||
"name": "Share to NotionNext",
|
"name": "Share to NotionNext",
|
||||||
"version": "1.1.1",
|
"version": "2.3.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",
|
||||||
|
|||||||
@@ -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, 默认是空,可直接删除
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "share-to-notionnext",
|
"name": "share-to-notionnext",
|
||||||
"version": "1.1.1",
|
"version": "2.3.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",
|
||||||
@@ -15,17 +15,18 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.7",
|
"@types/node": "^20.5.7",
|
||||||
"@types/yaml-front-matter": "^4.1.3",
|
"@types/yaml-front-matter": "^4.1.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
||||||
"@typescript-eslint/parser": "^6.11.0",
|
"@typescript-eslint/parser": "^6.16.0",
|
||||||
"builtin-modules": "^3.2.0",
|
"builtin-modules": "^3.3.0",
|
||||||
"esbuild": "0.19.5",
|
"esbuild": "0.19.5",
|
||||||
"obsidian": "latest",
|
"obsidian": "^1.6.6",
|
||||||
"tslib": "2.6.2",
|
"tslib": "2.6.2",
|
||||||
"typescript": "5.2.2"
|
"typescript": "5.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tryfabric/martian": "^1.2.4",
|
"@jxpeng98/martian": "^1.2.7",
|
||||||
"https-proxy-agent": "^7.0.2",
|
"https-proxy-agent": "^7.0.2",
|
||||||
|
"node-fetch": "^3.3.2",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"remark-math": "^6.0.0",
|
"remark-math": "^6.0.0",
|
||||||
"yaml": "^2.3.4",
|
"yaml": "^2.3.4",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export interface DatabaseList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class FuzzySuggester extends FuzzySuggestModal<DatabaseList>{
|
export class FuzzySuggester extends FuzzySuggestModal<DatabaseList> {
|
||||||
private plugin: MyPlugin;
|
private plugin: MyPlugin;
|
||||||
private data: DatabaseList[];
|
private data: DatabaseList[];
|
||||||
private callback: any;
|
private callback: any;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { i18nConfig } from "src/lang/I18n";
|
import { i18nConfig } from "src/lang/I18n";
|
||||||
import { Editor, MarkdownView } from "obsidian";
|
import { Editor, MarkdownView, setTooltip } from "obsidian";
|
||||||
import { FuzzySuggester, DatabaseList } from "./FuzzySuggester";
|
import { FuzzySuggester, DatabaseList } from "./FuzzySuggester";
|
||||||
import { uploadCommandGeneral, uploadCommandNext } from "../upload/uploadCommand";
|
import { uploadCommandCustom, uploadCommandGeneral, uploadCommandNext } from "../upload/uploadCommand";
|
||||||
import ObsidianSyncNotionPlugin from "src/main";
|
import ObsidianSyncNotionPlugin from "src/main";
|
||||||
|
import { DatabaseDetails } from "../ui/settingTabs";
|
||||||
|
|
||||||
|
|
||||||
interface Command {
|
interface Command {
|
||||||
@@ -21,26 +22,11 @@ export default class RibbonCommands {
|
|||||||
constructor(plugin: ObsidianSyncNotionPlugin) {
|
constructor(plugin: ObsidianSyncNotionPlugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
// Check if NextButton is true, then include the corresponding command
|
// iterate through the database detail
|
||||||
if (this.plugin.settings.NextButton) {
|
|
||||||
this.Ncommand.push({
|
|
||||||
id: "share-to-notionnext",
|
|
||||||
name: i18nConfig.CommandName, // Use the translated text from i18nConfig
|
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
|
||||||
await uploadCommandNext(this.plugin, this.plugin.settings, this.plugin.app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if GeneralButton is true, then include the corresponding command
|
for (let key in this.plugin.settings.databaseDetails) {
|
||||||
if (this.plugin.settings.GeneralButton) {
|
let dbDetails = this.plugin.settings.databaseDetails[key];
|
||||||
this.Ncommand.push({
|
this.addCommandForDatabase(dbDetails);
|
||||||
id: "share-to-notion",
|
|
||||||
name: i18nConfig.CommandNameGeneral, // Use the translated text from i18nConfig
|
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
|
||||||
await uploadCommandGeneral(this.plugin, this.plugin.settings, this.plugin.app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register all the commands
|
// Register all the commands
|
||||||
@@ -77,24 +63,9 @@ export default class RibbonCommands {
|
|||||||
|
|
||||||
this.Ncommand = [];
|
this.Ncommand = [];
|
||||||
|
|
||||||
if (this.plugin.settings.NextButton) {
|
for (let key in this.plugin.settings.databaseDetails) {
|
||||||
this.Ncommand.push({
|
let dbDetails = this.plugin.settings.databaseDetails[key];
|
||||||
id: "share-to-notionnext",
|
this.addCommandForDatabase(dbDetails);
|
||||||
name: i18nConfig.CommandName, // Use the translated text from i18nConfig
|
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
|
||||||
await uploadCommandNext(this.plugin, this.plugin.settings, this.plugin.app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.plugin.settings.GeneralButton) {
|
|
||||||
this.Ncommand.push({
|
|
||||||
id: "share-to-notion",
|
|
||||||
name: i18nConfig.CommandNameGeneral, // Use the translated text from i18nConfig
|
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
|
||||||
await uploadCommandGeneral(this.plugin, this.plugin.settings, this.plugin.app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Ncommand.forEach(command => {
|
this.Ncommand.forEach(command => {
|
||||||
@@ -107,4 +78,30 @@ export default class RibbonCommands {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private addCommandForDatabase(dbDetails: DatabaseDetails) {
|
||||||
|
// Example logic - adjust based on your specific requirements
|
||||||
|
let commandId = `share-to-${dbDetails.abName}`;
|
||||||
|
let commandName = `Share to ${dbDetails.fullName} (${dbDetails.abName})`; // or use a translated name
|
||||||
|
|
||||||
|
let editorCallback: (editor: Editor, view: MarkdownView) => Promise<void>;
|
||||||
|
if (dbDetails.format === 'next') {
|
||||||
|
editorCallback = async (editor, view) => {
|
||||||
|
await uploadCommandNext(this.plugin, this.plugin.settings, dbDetails, this.plugin.app);
|
||||||
|
};
|
||||||
|
} else if (dbDetails.format === 'general') {
|
||||||
|
editorCallback = async (editor, view) => {
|
||||||
|
await uploadCommandGeneral(this.plugin, this.plugin.settings, dbDetails, this.plugin.app);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (dbDetails.format === 'custom') {
|
||||||
|
editorCallback = async (editor, view) => {
|
||||||
|
await uploadCommandCustom(this.plugin, this.plugin.settings, dbDetails, this.plugin.app);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Ncommand.push({ id: commandId, name: commandName, editorCallback });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export const en = {
|
export const en = {
|
||||||
|
databaseFormat: "Database Format",
|
||||||
|
databaseFormatDesc: "Select the database format you want to sync to NotionNext or General",
|
||||||
|
databaseNext: "NotionNext",
|
||||||
|
databaseGeneral: "General",
|
||||||
|
databaseCustom: "Custom",
|
||||||
|
databaseFullName: "Database Full Name",
|
||||||
|
databaseFullNameDesc: "Please give a full name for your database",
|
||||||
|
databaseFullNameText: "Enter your database full name",
|
||||||
|
databaseAbbreviateName: "Database Abbreviate Name",
|
||||||
|
databaseAbbreviateNameDesc: "Please give a nick name for your database",
|
||||||
|
databaseAbbreviateNameText: "Enter your database nick name",
|
||||||
ribbonIcon: "Share to NotionNext",
|
ribbonIcon: "Share to NotionNext",
|
||||||
GeneralSetting: "General information Settings",
|
GeneralSetting: "General information Settings",
|
||||||
CommandID: "share-to-notionnext",
|
CommandID: "share-to-notionnext",
|
||||||
@@ -12,15 +23,18 @@ 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:
|
||||||
"Collect from share link likes:https://username.notion.site. Your notion id is [username]",
|
"Collect from share link likes:https://username.notion.site. Your notion id is [username]",
|
||||||
NotionUserText: "Enter your notion ID",
|
NotionUserText: "Enter your notion ID",
|
||||||
|
NotionLinkDisplay: "Notion Link Display",
|
||||||
|
NotionLinkDisplayDesc: "Default is ON, if you want to hide the link in the front matter, please turn it off",
|
||||||
NotionGeneralSettingHeader: "General Notion Database Settings",
|
NotionGeneralSettingHeader: "General Notion Database Settings",
|
||||||
NotionGeneralButton: "Notion General Sync",
|
NotionGeneralButton: "Notion General Sync",
|
||||||
NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette (default: ON)",
|
NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette (default: ON)",
|
||||||
@@ -31,24 +45,35 @@ export const en = {
|
|||||||
NotionCustomTitleName: "Preferred title name",
|
NotionCustomTitleName: "Preferred title name",
|
||||||
NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database (default: title)",
|
NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database (default: title)",
|
||||||
NotionCustomTitleText: "Enter the name",
|
NotionCustomTitleText: "Enter the name",
|
||||||
NotYetFinish:
|
NotionCustomValues: "Customise values property",
|
||||||
"Not finished. This function will be available in the next version",
|
NotionCustomValuesDesc: "Modify the column name of the Notion database,one per line",
|
||||||
|
NotionCustomValuesText: "Enter all properties that you want to sync",
|
||||||
|
NotYetFinish: "Not finished. This function will be available in the next version",
|
||||||
PlaceHolder: "Enter database Name",
|
PlaceHolder: "Enter database Name",
|
||||||
"notion-logo": "Share to NotionNext",
|
"notion-logo": "Share to NotionNext",
|
||||||
"sync-success": "Sync to NotionNext success: \n",
|
"sync-preffix": "Sync to ",
|
||||||
"sync-fail": "Sync to NotionNext fail: \n",
|
"sync-success": "success",
|
||||||
|
"sync-fail": "failed",
|
||||||
"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":
|
"config-secrets-notion-api":
|
||||||
"Please set up the notion API in the settings tab.",
|
"Please set up the notion API in the settings tab.",
|
||||||
"config-secrets-database-id":
|
"config-secrets-database-id":
|
||||||
"Please set up the database id in the settings tab.",
|
"Please set up the database id in the settings tab.",
|
||||||
"set-tags-fail":
|
"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,please check the frontmatter of the file or close the tag switch in the settings tab.",
|
||||||
NNonMissing:
|
NNonMissing:
|
||||||
"The 'NNon' property is missing in the settings. Please set it up.",
|
"The 'NNon' property is missing in the settings. Please set it up.",
|
||||||
"set-api-id":
|
"set-api-id":
|
||||||
"Please set up the notion API and database ID in the settings tab.",
|
"Please set up the notion API and database ID in the settings tab.",
|
||||||
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",
|
||||||
|
CopyErrorMessage: "Auto copy failed, please copy it manually",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export const ja = {
|
export const ja = {
|
||||||
|
databaseFormat: "データベース形式",
|
||||||
|
databaseFormatDesc: "同期したいデータベース形式を選択してください",
|
||||||
|
databaseNext: "NotionNext",
|
||||||
|
databaseGeneral: "一般的なNotion",
|
||||||
|
databaseCustom: "カスタム",
|
||||||
|
databaseFullName: "データベースの全称",
|
||||||
|
databaseFullNameDesc: "データベースの全称を入力してください",
|
||||||
|
databaseFullNameText: "データベースの全称を入力",
|
||||||
|
databaseAbbreviateName: "データベースの略称",
|
||||||
|
databaseAbbreviateNameDesc: "データベースの略称を入力してください",
|
||||||
|
databaseAbbreviateNameText: "データベースの略称を入力",
|
||||||
ribbonIcon: "NotionNextで共有",
|
ribbonIcon: "NotionNextで共有",
|
||||||
GeneralSetting: "一般設定",
|
GeneralSetting: "一般設定",
|
||||||
CommandID: "share-to-notionnext",
|
CommandID: "share-to-notionnext",
|
||||||
@@ -12,13 +23,16 @@ 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]です",
|
||||||
NotionUserText: "Notion IDを入力",
|
NotionUserText: "Notion IDを入力",
|
||||||
|
NotionLinkDisplay: "Notionリンク表示",
|
||||||
|
NotionLinkDisplayDesc: "デフォルトはONです。front matterにリンクを非表示にしたい場合は、オフにしてください",
|
||||||
NotionGeneralSettingHeader: "一般的なNotionデータベース設定",
|
NotionGeneralSettingHeader: "一般的なNotionデータベース設定",
|
||||||
NotionGeneralButton: "一般的なNotion同期",
|
NotionGeneralButton: "一般的なNotion同期",
|
||||||
NotionGeneralButtonDesc: "このオプションを開くと、一般的なNotionデータベース同期コマンドがコマンドパレットに表示されます(デフォルト:ON)",
|
NotionGeneralButtonDesc: "このオプションを開くと、一般的なNotionデータベース同期コマンドがコマンドパレットに表示されます(デフォルト:ON)",
|
||||||
@@ -29,6 +43,9 @@ export const ja = {
|
|||||||
NotionCustomTitleName: "希望のタイトル名",
|
NotionCustomTitleName: "希望のタイトル名",
|
||||||
NotionCustomTitleNameDesc: "Notionデータベースの最初の列のための希望のタイトル名を入力(デフォルト:title)",
|
NotionCustomTitleNameDesc: "Notionデータベースの最初の列のための希望のタイトル名を入力(デフォルト:title)",
|
||||||
NotionCustomTitleText: "名前を入力",
|
NotionCustomTitleText: "名前を入力",
|
||||||
|
NotionCustomValues: "値のカスタマイズ",
|
||||||
|
NotionCustomValuesDesc: "Notionデータベースの列名を変更、1行に1つ",
|
||||||
|
NotionCustomValuesText: "同期したいすべてのプロパティを入力",
|
||||||
NotYetFinish: "未完了。この機能は次のバージョンで利用可能になります",
|
NotYetFinish: "未完了。この機能は次のバージョンで利用可能になります",
|
||||||
PlaceHolder: "データベース名を入力",
|
PlaceHolder: "データベース名を入力",
|
||||||
"notion-logo": "NotionNextで共有",
|
"notion-logo": "NotionNextで共有",
|
||||||
@@ -43,4 +60,12 @@ export const ja = {
|
|||||||
NotionCustomSettingHeader: "Notionカスタムデータベース設定",
|
NotionCustomSettingHeader: "Notionカスタムデータベース設定",
|
||||||
NotionCustomButton: "Notionカスタマイズコマンドの切り替え",
|
NotionCustomButton: "Notionカスタマイズコマンドの切り替え",
|
||||||
NotionCustomButtonDesc: "このオプションを開くと、Notionカスタムデータベース同期コマンドがコマンドパレットに表示されます",
|
NotionCustomButtonDesc: "このオプションを開くと、Notionカスタムデータベース同期コマンドがコマンドパレットに表示されます",
|
||||||
|
CustomPropertyName: "カスタムプロパティ名",
|
||||||
|
CustomPropertyFirstColumn: "最初の列のカスタムプロパティ名",
|
||||||
|
CustomPropertyFirstColumnDesc: "最初の列のカスタムプロパティ名を入力してください",
|
||||||
|
CustomProperty: "カスタムプロパティ",
|
||||||
|
AddCustomProperty: "カスタムプロパティを追加",
|
||||||
|
AddNewProperty: "新しいプロパティを追加",
|
||||||
|
AddNewPropertyDesc: "新しいプロパティを追加してください",
|
||||||
|
CopyErrorMessage: "自動コピーに失敗しました",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export const zh = {
|
export const zh = {
|
||||||
|
databaseFormat: "数据库格式",
|
||||||
|
databaseFormatDesc: "选择你想要同步的数据库格式Next 或者 普通",
|
||||||
|
databaseNext: "NotionNext",
|
||||||
|
databaseGeneral: "普通",
|
||||||
|
databaseCustom: "自定义",
|
||||||
|
databaseFullName: "数据库全称",
|
||||||
|
databaseFullNameDesc: "给你的数据库起一个全称",
|
||||||
|
databaseFullNameText: "输入你的数据库全称",
|
||||||
|
databaseAbbreviateName: "数据库简称",
|
||||||
|
databaseAbbreviateNameDesc: "给你的数据库起一个简称",
|
||||||
|
databaseAbbreviateNameText: "输入你的数据库简称",
|
||||||
ribbonIcon: "分享到 NotionNext",
|
ribbonIcon: "分享到 NotionNext",
|
||||||
GeneralSetting: "通用设置",
|
GeneralSetting: "通用设置",
|
||||||
CommandID: "share-to-notionnext",
|
CommandID: "share-to-notionnext",
|
||||||
@@ -12,15 +23,18 @@ 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:
|
||||||
"数据库分享链接类似:https://username.notion.site/。你的 Notion ID 是 [username]",
|
"数据库分享链接类似:https://username.notion.site/。你的 Notion ID 是 [username]",
|
||||||
NotionUserText: "输入你的 Notion ID",
|
NotionUserText: "输入你的 Notion ID",
|
||||||
|
NotionLinkDisplay: "Notion 链接显示",
|
||||||
|
NotionLinkDisplayDesc: "默认开启,如果你不想在front matter中显示链接,请关闭",
|
||||||
NotionGeneralSettingHeader: "普通 Notion 数据库设置",
|
NotionGeneralSettingHeader: "普通 Notion 数据库设置",
|
||||||
NotionGeneralButton: "普通数据库同步",
|
NotionGeneralButton: "普通数据库同步",
|
||||||
NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中(默认:开)",
|
NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中(默认:开)",
|
||||||
@@ -31,6 +45,9 @@ export const zh = {
|
|||||||
NotionCustomTitleName: "想要修改的表头名",
|
NotionCustomTitleName: "想要修改的表头名",
|
||||||
NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名(默认:title)",
|
NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名(默认:title)",
|
||||||
NotionCustomTitleText: "输入表头名",
|
NotionCustomTitleText: "输入表头名",
|
||||||
|
NotionCustomValues: "自定义Notion 数据库表头",
|
||||||
|
NotionCustomValuesDesc: "自定义Notion 数据库表头,每行一个",
|
||||||
|
NotionCustomValuesText: "输入你想要同步的所有属性",
|
||||||
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
||||||
PlaceHolder: "输入数据库名称",
|
PlaceHolder: "输入数据库名称",
|
||||||
"notion-logo": "分享到NotionNext",
|
"notion-logo": "分享到NotionNext",
|
||||||
@@ -46,4 +63,12 @@ export const zh = {
|
|||||||
NotionCustomSettingHeader: "Notion 自定义数据库设置",
|
NotionCustomSettingHeader: "Notion 自定义数据库设置",
|
||||||
NotionCustomButton: "Notion 自定义数据库同步命令开关",
|
NotionCustomButton: "Notion 自定义数据库同步命令开关",
|
||||||
NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中",
|
NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中",
|
||||||
|
CustomPropertyName: "自定义属性名",
|
||||||
|
CustomPropertyFirstColumn: "第一列属性名",
|
||||||
|
CustomPropertyFirstColumnDesc: "第一列必须为标题属性名",
|
||||||
|
CustomProperty: "自定义属性",
|
||||||
|
AddCustomProperty: "添加自定义属性",
|
||||||
|
AddNewProperty: "添加新属性",
|
||||||
|
AddNewPropertyDesc: "添加一个和Notion数据库匹配的新属性",
|
||||||
|
CopyErrorMessage: "复制链接失败,请手动复制",
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/main.ts
29
src/main.ts
@@ -4,7 +4,7 @@ import { Upload2NotionGeneral } from "src/upload/upload_general/Upload2NotionGen
|
|||||||
import { Upload2NotionNext } from "src/upload/upload_next/Upload2NotionNext";
|
import { Upload2NotionNext } from "src/upload/upload_next/Upload2NotionNext";
|
||||||
import { i18nConfig } from "src/lang/I18n";
|
import { i18nConfig } from "src/lang/I18n";
|
||||||
import ribbonCommands from "src/commands/NotionCommands";
|
import ribbonCommands from "src/commands/NotionCommands";
|
||||||
import { ObsidianSettingTab, PluginSettings, DEFAULT_SETTINGS } from "src/ui/settingTabs";
|
import { ObsidianSettingTab, PluginSettings, DEFAULT_SETTINGS, DatabaseDetails } from "src/ui/settingTabs";
|
||||||
|
|
||||||
// Remember to rename these classes and interfaces!
|
// Remember to rename these classes and interfaces!
|
||||||
|
|
||||||
@@ -55,6 +55,33 @@ export default class ObsidianSyncNotionPlugin extends Plugin {
|
|||||||
await this.saveData(this.settings);
|
await this.saveData(this.settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addDatabaseDetails(dbDetails: DatabaseDetails) {
|
||||||
|
this.settings.databaseDetails = {
|
||||||
|
...this.settings.databaseDetails,
|
||||||
|
[dbDetails.abName]: dbDetails,
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteDatabaseDetails(dbDetails: DatabaseDetails) {
|
||||||
|
delete this.settings.databaseDetails[dbDetails.abName];
|
||||||
|
|
||||||
|
await this.saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateDatabaseDetails(dbDetails: DatabaseDetails) {
|
||||||
|
// delete the old database details
|
||||||
|
delete this.settings.databaseDetails[dbDetails.abName];
|
||||||
|
|
||||||
|
this.settings.databaseDetails = {
|
||||||
|
...this.settings.databaseDetails,
|
||||||
|
[dbDetails.abName]: dbDetails,
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
64
src/ui/DeleteModal.ts
Normal file
64
src/ui/DeleteModal.ts
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import { App, ButtonComponent, Modal, Setting } from "obsidian";
|
||||||
|
import { DatabaseDetails, ObsidianSettingTab } from "./settingTabs";
|
||||||
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
|
|
||||||
|
export class DeleteModal extends Modal {
|
||||||
|
data: Record<string, any> = {
|
||||||
|
deleted: false,
|
||||||
|
}
|
||||||
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
settingTab: ObsidianSettingTab;
|
||||||
|
dbDetails: DatabaseDetails
|
||||||
|
|
||||||
|
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab, dbDetails: DatabaseDetails) {
|
||||||
|
super(app);
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.settingTab = settingTab;
|
||||||
|
this.dbDetails = dbDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
display() {
|
||||||
|
this.containerEl.addClass("delete-modal");
|
||||||
|
this.titleEl.setText('Delete Database');
|
||||||
|
|
||||||
|
let { contentEl } = this;
|
||||||
|
contentEl.empty();
|
||||||
|
|
||||||
|
const deleteDiv = contentEl.createDiv('delete-div');
|
||||||
|
deleteDiv.createEl('h4', { text: 'Are you sure you want to delete the following database?' });
|
||||||
|
deleteDiv.createEl('h2', { text: this.dbDetails.fullName + ' (' + this.dbDetails.abName + ', ' + this.dbDetails.format + ')' });
|
||||||
|
|
||||||
|
|
||||||
|
// add delete button
|
||||||
|
let footerEl = contentEl.createDiv('save-button');
|
||||||
|
let deleteButton = new Setting(footerEl)
|
||||||
|
|
||||||
|
deleteButton
|
||||||
|
.addButton((button: ButtonComponent): ButtonComponent => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Delete")
|
||||||
|
.setIcon("trash")
|
||||||
|
.onClick(async () => {
|
||||||
|
this.data.deleted = true;
|
||||||
|
this.close();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteButton.addExtraButton((button) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Cancel')
|
||||||
|
.setIcon('cross')
|
||||||
|
.onClick(() => {
|
||||||
|
this.data.deleted = false;
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
this.display();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
349
src/ui/EditModal.ts
Normal file
349
src/ui/EditModal.ts
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
import { App, ButtonComponent, Setting } from "obsidian";
|
||||||
|
import { customProperty, SettingModal } from "./settingModal";
|
||||||
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
|
import { DatabaseDetails, ObsidianSettingTab } from "./settingTabs";
|
||||||
|
import { i18nConfig } from "../lang/I18n";
|
||||||
|
|
||||||
|
export class EditModal extends SettingModal {
|
||||||
|
propertyLines: Setting[] = []; // Store all property line settings
|
||||||
|
[key: string]: any; // Index signature
|
||||||
|
dataTemp: Record<string, any> = {
|
||||||
|
databaseFormatTemp: '',
|
||||||
|
// databaseFormatTempInd: false,
|
||||||
|
databaseFullNameTemp: '',
|
||||||
|
// databaseFullNameTempInd: false,
|
||||||
|
databaseAbbreviateNameTemp: '',
|
||||||
|
// databaseAbbreviateNameTempInd: false,
|
||||||
|
notionAPITemp: '',
|
||||||
|
// notionAPITempInd: false,
|
||||||
|
databaseIDTemp: '',
|
||||||
|
// databaseIDTempInd: false,
|
||||||
|
tagButtonTemp: false,
|
||||||
|
// tagButtonTempInd: false,
|
||||||
|
customTitleButtonTemp: false,
|
||||||
|
// customTitleButtonTempInd: false,
|
||||||
|
customTitleNameTemp: '',
|
||||||
|
customPropertiesTemp: [],
|
||||||
|
// customTitleNameTempInd: false,
|
||||||
|
// customValues: '',
|
||||||
|
savedTemp: false,
|
||||||
|
savedTempInd: false,
|
||||||
|
};
|
||||||
|
dataPrev: Record<string, any> = {
|
||||||
|
databaseFormatPrev: '',
|
||||||
|
// databaseFormatPrevInd: false,
|
||||||
|
databaseFullNamePrev: '',
|
||||||
|
// databaseFullNamePrevInd: false,
|
||||||
|
databaseAbbreviateNamePrev: '',
|
||||||
|
// databaseAbbreviateNamePrevInd: false,
|
||||||
|
notionAPIPrev: '',
|
||||||
|
// notionAPIPrevInd: false,
|
||||||
|
databaseIDPrev: '',
|
||||||
|
// databaseIDPrevInd: false,
|
||||||
|
tagButtonPrev: false,
|
||||||
|
// tagButtonPrevInd: false,
|
||||||
|
customTitleButtonPrev: false,
|
||||||
|
// customTitleButtonPrevInd: false,
|
||||||
|
customTitleNamePrev: '',
|
||||||
|
customPropertiesPrev: [],
|
||||||
|
// customTitleNamePrevInd: false,
|
||||||
|
// customValues: '',
|
||||||
|
savedPrev: false,
|
||||||
|
savedPrevInd: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
settingTab: ObsidianSettingTab;
|
||||||
|
dbDetails: DatabaseDetails;
|
||||||
|
|
||||||
|
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab, dbDetails: DatabaseDetails) {
|
||||||
|
super(app, plugin, settingTab);
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.settingTab = settingTab;
|
||||||
|
if (dbDetails) {
|
||||||
|
// Temp details
|
||||||
|
this.dataTemp.databaseFormatTemp = dbDetails.format;
|
||||||
|
this.dataTemp.databaseFullNameTemp = dbDetails.fullName;
|
||||||
|
this.dataTemp.databaseAbbreviateNameTemp = dbDetails.abName;
|
||||||
|
this.dataTemp.notionAPITemp = dbDetails.notionAPI;
|
||||||
|
this.dataTemp.databaseIDTemp = dbDetails.databaseID;
|
||||||
|
this.dataTemp.tagButtonTemp = dbDetails.tagButton;
|
||||||
|
this.dataTemp.customTitleButtonTemp = dbDetails.customTitleButton;
|
||||||
|
this.dataTemp.customTitleNameTemp = dbDetails.customTitleName;
|
||||||
|
this.dataTemp.customPropertiesTemp = dbDetails.customProperties.map(prop => ({ ...prop })); // Ensure deep copy
|
||||||
|
// this.dataTemp.customValues = dbDetails.customValues;
|
||||||
|
this.dataTemp.savedTemp = dbDetails.saved;
|
||||||
|
|
||||||
|
// Prev details
|
||||||
|
this.dataPrev.databaseFormatPrev = dbDetails.format;
|
||||||
|
this.dataPrev.databaseFullNamePrev = dbDetails.fullName;
|
||||||
|
this.dataPrev.databaseAbbreviateNamePrev = dbDetails.abName;
|
||||||
|
this.dataPrev.notionAPIPrev = dbDetails.notionAPI;
|
||||||
|
this.dataPrev.databaseIDPrev = dbDetails.databaseID;
|
||||||
|
this.dataPrev.tagButtonPrev = dbDetails.tagButton;
|
||||||
|
this.dataPrev.customTitleButtonPrev = dbDetails.customTitleButton;
|
||||||
|
this.dataPrev.customTitleNamePrev = dbDetails.customTitleName;
|
||||||
|
this.dataPrev.customPropertiesPrev = dbDetails.customProperties.map(prop => ({ ...prop })); // Ensure deep copy
|
||||||
|
// this.dataTemp.customValues = dbDetails.customValues;
|
||||||
|
this.dataPrev.savedPrev = dbDetails.saved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
display(): void {
|
||||||
|
this.containerEl.addClass("edit-modal");
|
||||||
|
this.titleEl.setText('Edit Database');
|
||||||
|
|
||||||
|
let { contentEl } = this;
|
||||||
|
contentEl.empty();
|
||||||
|
|
||||||
|
const editDiv = contentEl.createDiv('edit-div');
|
||||||
|
const nextTabs = contentEl.createDiv('next-tabs');
|
||||||
|
|
||||||
|
|
||||||
|
new Setting(editDiv)
|
||||||
|
.setName(i18nConfig.databaseFormat)
|
||||||
|
.setDesc(i18nConfig.databaseFormatDesc)
|
||||||
|
.addDropdown((component) => {
|
||||||
|
component
|
||||||
|
.addOption('none', '')
|
||||||
|
.addOption('general', i18nConfig.databaseGeneral)
|
||||||
|
.addOption('next', i18nConfig.databaseNext)
|
||||||
|
.addOption('custom', i18nConfig.databaseCustom)
|
||||||
|
.setValue(this.dataTemp.databaseFormatTemp)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.dataTemp.databaseFormatTemp = value;
|
||||||
|
nextTabs.empty();
|
||||||
|
this.updateContentBasedOnSelection(value, nextTabs);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize content based on the current dropdown value
|
||||||
|
this.updateContentBasedOnSelection(this.dataTemp.databaseFormatTemp, nextTabs);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// add save button
|
||||||
|
let footerEl = contentEl.createDiv('save-button');
|
||||||
|
let saveButton = new Setting(footerEl)
|
||||||
|
saveButton.addButton((button: ButtonComponent) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Save')
|
||||||
|
.setIcon('checkmark')
|
||||||
|
.onClick(async () => {
|
||||||
|
this.dataTemp.savedTempInd = true;
|
||||||
|
this.dataTemp.savedTemp = true;
|
||||||
|
// console.log(this.dataTemp);
|
||||||
|
// console.log(this.dataPrev);
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
saveButton.addExtraButton((button) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Cancel')
|
||||||
|
.setIcon('cross')
|
||||||
|
.onClick(() => {
|
||||||
|
// console.log(this.dataTemp);
|
||||||
|
// console.log(this.dataPrev);
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen(): void {
|
||||||
|
this.display()
|
||||||
|
}
|
||||||
|
|
||||||
|
updateContentBasedOnSelection(value: string, nextTabs: HTMLElement): void {
|
||||||
|
// Clear existing content
|
||||||
|
nextTabs.empty();
|
||||||
|
|
||||||
|
// Generate content based on the selected value
|
||||||
|
if (value === 'general') {
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionGeneralSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.dataTemp.databaseFullNameTemp, 'dataTemp', 'databaseFullNameTemp')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.dataTemp.databaseAbbreviateNameTemp, 'dataTemp', 'databaseAbbreviateNameTemp')
|
||||||
|
|
||||||
|
// tag button
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.dataTemp.tagButtonTemp, 'dataTemp', 'tagButtonTemp')
|
||||||
|
|
||||||
|
// add custom title button
|
||||||
|
|
||||||
|
new Setting(nextTabs)
|
||||||
|
.setName(i18nConfig.NotionCustomTitle)
|
||||||
|
.setDesc(i18nConfig.NotionCustomTitleDesc)
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle
|
||||||
|
.setValue(this.dataTemp.customTitleButtonTemp)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.dataTemp.customTitleButtonTemp = value;
|
||||||
|
this.updateSettingEl(CustomNameEl, value)
|
||||||
|
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// add custom title name
|
||||||
|
const CustomNameEl = this.createStyleDiv('custom-name', (this.dataTemp.customTitleButtonTemp), nextTabs);
|
||||||
|
this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.dataTemp.customTitleNameTemp, 'dataTemp', 'customTitleNameTemp')
|
||||||
|
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp', 'notionAPITemp')
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp', 'databaseIDTemp')
|
||||||
|
|
||||||
|
|
||||||
|
} else if (value === 'next') {
|
||||||
|
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionNextSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.dataTemp.databaseFullNameTemp, 'dataTemp', 'databaseFullNameTemp')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.dataTemp.databaseAbbreviateNameTemp, 'dataTemp', 'databaseAbbreviateNameTemp')
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp', 'notionAPITemp')
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp', 'databaseIDTemp')
|
||||||
|
|
||||||
|
} else if (value === 'custom') {
|
||||||
|
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionCustomSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.dataTemp.databaseFullNameTemp, 'dataTemp', 'databaseFullNameTemp')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.dataTemp.databaseAbbreviateNameTemp, 'dataTemp', 'databaseAbbreviateNameTemp')
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.dataTemp.notionAPITemp, 'dataTemp', 'notionAPITemp')
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.dataTemp.databaseIDTemp, 'dataTemp', 'databaseIDTemp')
|
||||||
|
|
||||||
|
// add custom properties
|
||||||
|
this.initializePropertyLines(nextTabs, this.dataTemp.customPropertiesTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initializePropertyLines(containerEl: HTMLElement, properties: customProperty[]): void {
|
||||||
|
if (!containerEl) {
|
||||||
|
console.error('Failed to initialize property lines: containerEl is null');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("Add New Property")
|
||||||
|
.setDesc("Click to add a new property")
|
||||||
|
.addButton(button => {
|
||||||
|
return button
|
||||||
|
.setButtonText('Add')
|
||||||
|
.setTooltip('Add one more property')
|
||||||
|
.onClick(() => {
|
||||||
|
this.createPropertyLine(containerEl, properties);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
properties.forEach(property => {
|
||||||
|
this.updatePropertyLine(containerEl, property, properties);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updatePropertyLine(containerEl: HTMLElement, property: customProperty, properties: customProperty[]) {
|
||||||
|
let isExistingProperty = property !== null;
|
||||||
|
const propertyIndex = isExistingProperty ? property.index : properties.length;
|
||||||
|
|
||||||
|
const propertyLine = new Setting(containerEl)
|
||||||
|
.setName(propertyIndex === 0 ? i18nConfig.CustomPropertyFirstColumn : `${i18nConfig.CustomProperty} ${propertyIndex}`)
|
||||||
|
.setDesc(propertyIndex === 0 ? i18nConfig.CustomPropertyFirstColumnDesc : "");
|
||||||
|
|
||||||
|
propertyLine.addText(text => {
|
||||||
|
text.setPlaceholder(i18nConfig.CustomPropertyName)
|
||||||
|
.setValue(isExistingProperty ? property.customName : "")
|
||||||
|
.onChange(value => {
|
||||||
|
const actualIndex = properties.findIndex(p => p.index === propertyIndex);
|
||||||
|
if (actualIndex !== -1) {
|
||||||
|
properties[actualIndex].customName = value;
|
||||||
|
} else {
|
||||||
|
properties.push({ customName: value, customType: '', index: propertyIndex });
|
||||||
|
isExistingProperty = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
propertyLine.addDropdown((dropdown) => {
|
||||||
|
const options: Record<string, string> = {
|
||||||
|
'rich_text': 'Text',
|
||||||
|
'number': 'Number',
|
||||||
|
'select': 'Select',
|
||||||
|
'multi_select': 'Multi-Select',
|
||||||
|
'date': 'Date',
|
||||||
|
'files': 'Files & Media',
|
||||||
|
'checkbox': 'Checkbox',
|
||||||
|
'url': 'URL',
|
||||||
|
'email': 'Email',
|
||||||
|
'phone_number': 'Phone Number'
|
||||||
|
};
|
||||||
|
|
||||||
|
if (propertyIndex === 0) {
|
||||||
|
dropdown.addOption('title', 'Title');
|
||||||
|
} else {
|
||||||
|
Object.keys(options).forEach(key => {
|
||||||
|
dropdown.addOption(key, options[key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdown.setValue(isExistingProperty ? property.customType : "")
|
||||||
|
.onChange(value => {
|
||||||
|
const actualIndex = properties.findIndex(p => p.index === propertyIndex);
|
||||||
|
if (actualIndex !== -1) {
|
||||||
|
properties[actualIndex].customType = value;
|
||||||
|
} else if (!isExistingProperty) {
|
||||||
|
properties.push({ customName: '', customType: value, index: propertyIndex });
|
||||||
|
isExistingProperty = true; // Update the flag to prevent re-adding
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (propertyIndex > 0) {
|
||||||
|
propertyLine.addButton(button => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Delete")
|
||||||
|
.setIcon("trash")
|
||||||
|
.onClick(() => {
|
||||||
|
console.log('Deleting property', properties[propertyIndex]);
|
||||||
|
this.deleteProperty(propertyIndex, properties);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.propertyLines.push(propertyLine);
|
||||||
|
this.updatePropertyLines();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
createStyleDiv(className: string, commandValue: boolean = false, parentEl: HTMLElement): HTMLDivElement {
|
||||||
|
return super.createStyleDiv(className, commandValue, parentEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSettingEl(element: HTMLElement, commandValue: boolean) {
|
||||||
|
super.updateSettingEl(element, commandValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
createSettingEl(contentEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any, dataRecord: string, settingsKey: string): Setting {
|
||||||
|
return super.createSettingEl(contentEl, name, desc, type, placeholder, holderValue, dataRecord, settingsKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
178
src/ui/PreviewModal.ts
Normal file
178
src/ui/PreviewModal.ts
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
import { App, ExtraButtonComponent, Modal, Notice, Setting } from "obsidian";
|
||||||
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
|
import { DatabaseDetails, ObsidianSettingTab } from "./settingTabs";
|
||||||
|
import { customProperty } from "./settingModal";
|
||||||
|
import { i18nConfig } from "../lang/I18n";
|
||||||
|
|
||||||
|
export class PreviewModal extends Modal {
|
||||||
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
settingTab: ObsidianSettingTab;
|
||||||
|
dbDetails: DatabaseDetails;
|
||||||
|
|
||||||
|
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab, dbDetails: DatabaseDetails) {
|
||||||
|
super(app);
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.settingTab = settingTab;
|
||||||
|
this.dbDetails = dbDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
display(): void {
|
||||||
|
this.containerEl.addClass('preview-modal')
|
||||||
|
this.titleEl.setText('Preview')
|
||||||
|
|
||||||
|
let { contentEl } = this;
|
||||||
|
|
||||||
|
const previewEl = contentEl.createDiv('preview-content')
|
||||||
|
|
||||||
|
const dbFormatEl = new Setting(previewEl)
|
||||||
|
dbFormatEl
|
||||||
|
.setName('Database Format')
|
||||||
|
.addText(text => text
|
||||||
|
.setValue(this.dbDetails.format)
|
||||||
|
.setDisabled(true));
|
||||||
|
|
||||||
|
const dbFullEl = new Setting(previewEl)
|
||||||
|
dbFullEl
|
||||||
|
.setName('Database Full Name')
|
||||||
|
.addText(text => text
|
||||||
|
.setValue(this.dbDetails.fullName)
|
||||||
|
.setDisabled(true));
|
||||||
|
|
||||||
|
const dbAbbrEl = new Setting(previewEl)
|
||||||
|
dbAbbrEl
|
||||||
|
.setName('Database Abbreviate Name')
|
||||||
|
.addText(text => text
|
||||||
|
.setValue(this.dbDetails.abName)
|
||||||
|
.setDisabled(true));
|
||||||
|
// .controlEl.createEl('p', { text: this.dbDetails.abName })
|
||||||
|
|
||||||
|
// Setting for toggle and copy buttons
|
||||||
|
new Setting(previewEl)
|
||||||
|
.setName('Notion API Key')
|
||||||
|
.addExtraButton((button: ExtraButtonComponent) => {
|
||||||
|
let isApiKeyVisible = false;
|
||||||
|
|
||||||
|
return button
|
||||||
|
.setTooltip('Toggle API Key Visibility')
|
||||||
|
.setIcon('eye')
|
||||||
|
.onClick(() => {
|
||||||
|
isApiKeyVisible = !isApiKeyVisible;
|
||||||
|
button.setIcon(isApiKeyVisible ? 'eye-off' : 'eye');
|
||||||
|
apiKeySetting.settingEl.style.display = isApiKeyVisible ? '' : 'none'; // Toggle visibility
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Setting for displaying the API key
|
||||||
|
const apiKeySetting = new Setting(previewEl)
|
||||||
|
|
||||||
|
apiKeySetting.infoEl.createEl('p', { text: this.dbDetails.notionAPI })
|
||||||
|
|
||||||
|
|
||||||
|
apiKeySetting
|
||||||
|
.addExtraButton((button: ExtraButtonComponent) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Copy API Key')
|
||||||
|
.setIcon('clipboard')
|
||||||
|
.onClick(() => {
|
||||||
|
navigator.clipboard.writeText(this.dbDetails.notionAPI)
|
||||||
|
new Notice('API Key copied to clipboard');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
apiKeySetting.settingEl.style.display = 'none'; // Hide initially
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
new Setting(previewEl)
|
||||||
|
.setName('Database ID')
|
||||||
|
.addExtraButton((button: ExtraButtonComponent) => {
|
||||||
|
let isDbIdVisible = false;
|
||||||
|
|
||||||
|
return button
|
||||||
|
.setTooltip('Toggle Database ID Visibility')
|
||||||
|
.setIcon('eye')
|
||||||
|
.onClick(() => {
|
||||||
|
|
||||||
|
isDbIdVisible = !isDbIdVisible;
|
||||||
|
button.setIcon(isDbIdVisible ? 'eye-off' : 'eye');
|
||||||
|
dbIdSetting.settingEl.style.display = isDbIdVisible ? '' : 'none'; // Toggle visibility
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
const dbIdSetting = new Setting(previewEl)
|
||||||
|
|
||||||
|
dbIdSetting.infoEl.createEl('p', { text: this.dbDetails.databaseID })
|
||||||
|
|
||||||
|
dbIdSetting
|
||||||
|
.addExtraButton((button: ExtraButtonComponent) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Copy Database ID')
|
||||||
|
.setIcon('clipboard')
|
||||||
|
.onClick(() => {
|
||||||
|
navigator.clipboard.writeText(this.dbDetails.databaseID)
|
||||||
|
new Notice('Database ID copied to clipboard');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
dbIdSetting.settingEl.style.display = 'none'; // Hide initially
|
||||||
|
|
||||||
|
// Preview the custom properties
|
||||||
|
|
||||||
|
if (this.dbDetails.format === 'custom') {
|
||||||
|
|
||||||
|
const customPrv = previewEl.createDiv("custom-tabs");
|
||||||
|
|
||||||
|
this.previewPropertyLine(previewEl, this.dbDetails.customProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
this.display()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
previewPropertyLine(containerEl: HTMLElement, properties: customProperty[]): void {
|
||||||
|
|
||||||
|
properties.forEach((property, index) => {
|
||||||
|
const propertyLine = new Setting(containerEl)
|
||||||
|
.setName(index === 0 ? i18nConfig.CustomPropertyFirstColumn : `${i18nConfig.CustomProperty} ${index}`)
|
||||||
|
.setDesc(index === 0 ? i18nConfig.CustomPropertyFirstColumnDesc : "");
|
||||||
|
|
||||||
|
propertyLine.addText(text => {
|
||||||
|
text.setPlaceholder(i18nConfig.CustomPropertyName)
|
||||||
|
.setValue(property.customName)
|
||||||
|
.setDisabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
propertyLine.addDropdown((dropdown) => {
|
||||||
|
const options: Record<string, string> = {
|
||||||
|
'title': 'Title',
|
||||||
|
'rich_text': 'Text',
|
||||||
|
'number': 'Number',
|
||||||
|
'select': 'Select',
|
||||||
|
'multi_select': 'Multi-Select',
|
||||||
|
'date': 'Date',
|
||||||
|
'files': 'Files & Media',
|
||||||
|
'checkbox': 'Checkbox',
|
||||||
|
'url': 'URL',
|
||||||
|
'email': 'Email',
|
||||||
|
'phone_number': 'Phone Number',
|
||||||
|
// Additional options can be added here
|
||||||
|
};
|
||||||
|
|
||||||
|
// Populate dropdown with options
|
||||||
|
Object.keys(options).forEach(key => {
|
||||||
|
dropdown.addOption(key, options[key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
dropdown.setValue(property.customType)
|
||||||
|
.setDisabled(true); // Disable dropdown to prevent changes
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
377
src/ui/settingModal.ts
Normal file
377
src/ui/settingModal.ts
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
import {
|
||||||
|
Modal,
|
||||||
|
Setting,
|
||||||
|
ButtonComponent, App
|
||||||
|
} from 'obsidian';
|
||||||
|
|
||||||
|
import { i18nConfig } from "../lang/I18n";
|
||||||
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
|
import { DatabaseDetails, ObsidianSettingTab } from "./settingTabs";
|
||||||
|
|
||||||
|
export interface customProperty {
|
||||||
|
customName: string;
|
||||||
|
customType: string;
|
||||||
|
index: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SettingModal extends Modal {
|
||||||
|
propertyLines: Setting[] = []; // Store all property line settings
|
||||||
|
properties: customProperty[] = []; // Array to store property values and types
|
||||||
|
[key: string]: any; // Index signature
|
||||||
|
data: Record<string, any> = {
|
||||||
|
databaseFormat: 'none',
|
||||||
|
databaseFullName: '',
|
||||||
|
databaseAbbreviateName: '',
|
||||||
|
notionAPI: '',
|
||||||
|
databaseID: '',
|
||||||
|
tagButton: true,
|
||||||
|
customTitleButton: false,
|
||||||
|
customTitleName: '',
|
||||||
|
customProperties: [],
|
||||||
|
// customValues: '',
|
||||||
|
saved: false,
|
||||||
|
};
|
||||||
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
settingTab: ObsidianSettingTab;
|
||||||
|
|
||||||
|
constructor(app: App, plugin: ObsidianSyncNotionPlugin, settingTab: ObsidianSettingTab, dbDetails?: DatabaseDetails) {
|
||||||
|
super(app);
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.settingTab = settingTab;
|
||||||
|
this.properties = [];
|
||||||
|
if (dbDetails) {
|
||||||
|
this.data.databaseFormat = dbDetails.format;
|
||||||
|
this.data.databaseFullName = dbDetails.fullName;
|
||||||
|
this.data.databaseAbbreviateName = dbDetails.abName;
|
||||||
|
this.data.notionAPI = dbDetails.notionAPI;
|
||||||
|
this.data.databaseID = dbDetails.databaseID;
|
||||||
|
this.data.tagButton = dbDetails.tagButton;
|
||||||
|
this.data.customTitleButton = dbDetails.customTitleButton;
|
||||||
|
this.data.customTitleName = dbDetails.customTitleName;
|
||||||
|
this.data.customProperties = dbDetails.customProperties;
|
||||||
|
// this.data.customValues = dbDetails.customValues;
|
||||||
|
this.data.saved = dbDetails.saved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
display(): void {
|
||||||
|
this.containerEl.addClass("settings-modal");
|
||||||
|
this.titleEl.setText('Add new database');
|
||||||
|
|
||||||
|
// create the dropdown button to select the database format
|
||||||
|
let { contentEl } = this;
|
||||||
|
contentEl.empty();
|
||||||
|
|
||||||
|
const settingDiv = contentEl.createDiv('setting-div');
|
||||||
|
const nextTabs = contentEl.createDiv('next-tabs');
|
||||||
|
|
||||||
|
|
||||||
|
new Setting(settingDiv)
|
||||||
|
.setName(i18nConfig.databaseFormat)
|
||||||
|
.setDesc(i18nConfig.databaseFormatDesc)
|
||||||
|
.addDropdown((component) => {
|
||||||
|
component
|
||||||
|
.addOption('none', '')
|
||||||
|
.addOption('general', i18nConfig.databaseGeneral)
|
||||||
|
.addOption('next', i18nConfig.databaseNext)
|
||||||
|
.addOption('custom', i18nConfig.databaseCustom)
|
||||||
|
.setValue(this.data.databaseFormat)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.data.databaseFormat = value;
|
||||||
|
nextTabs.empty();
|
||||||
|
this.updateContentBasedOnSelection(value, nextTabs);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize content based on the current dropdown value
|
||||||
|
(this.data.saved) ? this.updateContentBasedOnSelection(this.data.databaseFormat, nextTabs) : this.updateContentBasedOnSelection(this.plugin.settings.databaseFormat, nextTabs);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// add save button
|
||||||
|
let footerEl = contentEl.createDiv('save-button');
|
||||||
|
let saveButton = new Setting(footerEl)
|
||||||
|
saveButton.addButton((button: ButtonComponent) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Save')
|
||||||
|
.setIcon('checkmark')
|
||||||
|
.onClick(async () => {
|
||||||
|
this.data.saved = true;
|
||||||
|
this.data.customProperties = this.properties;
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
saveButton.addExtraButton((button) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Cancel')
|
||||||
|
.setIcon('cross')
|
||||||
|
.onClick(() => {
|
||||||
|
this.data.saved = false;
|
||||||
|
// this.data.customProperties = this.properties;
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateContentBasedOnSelection(value: string, nextTabs: HTMLElement): void {
|
||||||
|
// Clear existing content
|
||||||
|
nextTabs.empty();
|
||||||
|
|
||||||
|
// Generate content based on the selected value
|
||||||
|
if (value === 'general') {
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionGeneralSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.data.databaseFullName, 'data', 'databaseFullName')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.data.databaseAbbreviateName, 'data', 'databaseAbbreviateName')
|
||||||
|
|
||||||
|
// tag button
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.data.tagButton, 'data', 'tagButton')
|
||||||
|
|
||||||
|
// add custom title button
|
||||||
|
|
||||||
|
new Setting(nextTabs)
|
||||||
|
.setName(i18nConfig.NotionCustomTitle)
|
||||||
|
.setDesc(i18nConfig.NotionCustomTitleDesc)
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle
|
||||||
|
.setValue(this.data.customTitleButton)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.data.customTitleButton = value;
|
||||||
|
this.updateSettingEl(CustomNameEl, value)
|
||||||
|
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// add custom title name
|
||||||
|
const CustomNameEl = this.createStyleDiv('custom-name', (this.data.customTitleButton), nextTabs);
|
||||||
|
this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.data.customTitleName, 'data', 'customTitleName')
|
||||||
|
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI')
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
|
||||||
|
|
||||||
|
|
||||||
|
} else if (value === 'next') {
|
||||||
|
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionNextSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.data.databaseFullName, 'data', 'databaseFullName')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.data.databaseAbbreviateName, 'data', 'databaseAbbreviateName')
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI')
|
||||||
|
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
|
||||||
|
|
||||||
|
} else if (value === 'custom') {
|
||||||
|
|
||||||
|
nextTabs.createEl('h3', { text: i18nConfig.NotionCustomSettingHeader });
|
||||||
|
|
||||||
|
// add full name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseFullName, i18nConfig.databaseFullNameDesc, 'text', i18nConfig.databaseFullNameText, this.data.databaseFullName, 'data', 'databaseFullName')
|
||||||
|
|
||||||
|
// add abbreviate name
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.databaseAbbreviateName, i18nConfig.databaseAbbreviateNameDesc, 'text', i18nConfig.databaseAbbreviateNameText, this.data.databaseAbbreviateName, 'data', 'databaseAbbreviateName')
|
||||||
|
|
||||||
|
// add api key
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.data.notionAPI, 'data', 'notionAPI')
|
||||||
|
|
||||||
|
// add database id
|
||||||
|
this.createSettingEl(nextTabs, i18nConfig.DatabaseID, i18nConfig.DatabaseIDDesc, 'password', i18nConfig.DatabaseIDText, this.data.databaseID, 'data', 'databaseID')
|
||||||
|
|
||||||
|
// add new property button
|
||||||
|
new Setting(nextTabs)
|
||||||
|
.setName(i18nConfig.NotionCustomValues)
|
||||||
|
.setDesc(i18nConfig.NotionCustomValuesDesc)
|
||||||
|
.addButton((button: ButtonComponent) => {
|
||||||
|
return button
|
||||||
|
.setTooltip('Add one more property')
|
||||||
|
.setButtonText('Add New Property')
|
||||||
|
.onClick(async () => {
|
||||||
|
const customTabs = nextTabs.createDiv("custom-tabs");
|
||||||
|
this.createPropertyLine(customTabs, this.properties);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
// add console log to check if the modal is opened
|
||||||
|
this.display()
|
||||||
|
}
|
||||||
|
|
||||||
|
createPropertyLine(containerEl: HTMLElement, properties: customProperty[]): void {
|
||||||
|
const propertyIndex = properties.length;
|
||||||
|
|
||||||
|
properties.push({ customName: "", customType: "", index: propertyIndex });
|
||||||
|
|
||||||
|
const propertyLine = new Setting(containerEl)
|
||||||
|
.setName(propertyIndex === 0 ? i18nConfig.CustomPropertyFirstColumn : `${i18nConfig.CustomProperty} ${propertyIndex}`)
|
||||||
|
.setDesc(propertyIndex === 0 ? i18nConfig.CustomPropertyFirstColumnDesc : "");
|
||||||
|
|
||||||
|
propertyLine.addText(text => {
|
||||||
|
text.setPlaceholder(i18nConfig.CustomPropertyName)
|
||||||
|
.setValue("")
|
||||||
|
.onChange(value => {
|
||||||
|
let actualIndex = properties.findIndex(p => p.index === propertyIndex);
|
||||||
|
if (actualIndex !== -1) {
|
||||||
|
properties[actualIndex].customName = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
propertyLine.addDropdown((dropdown) => {
|
||||||
|
const options: Record<string, string> = {
|
||||||
|
'rich_text': 'Text',
|
||||||
|
'number': 'Number',
|
||||||
|
'select': 'Select',
|
||||||
|
'multi_select': 'Multi-Select',
|
||||||
|
'date': 'Date',
|
||||||
|
'files': 'Files & Media',
|
||||||
|
'checkbox': 'Checkbox',
|
||||||
|
'url': 'URL',
|
||||||
|
'email': 'Email',
|
||||||
|
'phone_number': 'Phone Number',
|
||||||
|
// 'formula': 'Formula',
|
||||||
|
// 'relation': 'Relation',
|
||||||
|
// 'rollup': 'Rollup',
|
||||||
|
// 'created_time': 'Created time',
|
||||||
|
// 'created_by': 'Created by',
|
||||||
|
// 'last_edited_time': 'Last Edited Time',
|
||||||
|
// 'last_edited_by': 'Last Edited By',
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentProperty = properties[propertyIndex];
|
||||||
|
|
||||||
|
if (propertyIndex === 0) {
|
||||||
|
dropdown.addOption("title", "Title");
|
||||||
|
} else {
|
||||||
|
Object.keys(options).forEach(key => {
|
||||||
|
dropdown.addOption(key, options[key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
dropdown.setValue("")
|
||||||
|
.onChange(value => {
|
||||||
|
if (currentProperty) {
|
||||||
|
currentProperty.customType = value;
|
||||||
|
// Retrieve the index of currentProperty from the properties array
|
||||||
|
const updatedIndex = properties.findIndex(p => p === currentProperty);
|
||||||
|
console.log(`Updated value at index ${updatedIndex}: ${value}`);
|
||||||
|
} else {
|
||||||
|
console.log("Property not found, may have been deleted.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (propertyIndex > 0) {
|
||||||
|
propertyLine.addButton(button => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Delete")
|
||||||
|
.setIcon("trash")
|
||||||
|
.onClick(() => {
|
||||||
|
this.deleteProperty(propertyIndex, properties);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.propertyLines.push(propertyLine);
|
||||||
|
this.updatePropertyLines(); // Ensure property lines are updated after creation
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteProperty(propertyIndex: number, properties: customProperty[]): void {
|
||||||
|
let actualIndex = properties.findIndex(p => p.index === propertyIndex);
|
||||||
|
if (actualIndex !== -1) {
|
||||||
|
properties.splice(actualIndex, 1);
|
||||||
|
if (this.propertyLines[actualIndex]) {
|
||||||
|
this.propertyLines[actualIndex].settingEl.remove();
|
||||||
|
this.propertyLines.splice(actualIndex, 1);
|
||||||
|
}
|
||||||
|
// Update indices in the properties array
|
||||||
|
properties.forEach((prop, idx) => {
|
||||||
|
prop.index = idx;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.updatePropertyLines();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePropertyLines() {
|
||||||
|
this.propertyLines.forEach((line, idx) => {
|
||||||
|
line.setName(idx === 0 ? i18nConfig.CustomPropertyFirstColumn : `${i18nConfig.CustomProperty} ${idx}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a function to create a div with a style for pop over elements
|
||||||
|
public createStyleDiv(className: string, commandValue: boolean = false, parentEl: HTMLElement) {
|
||||||
|
return parentEl.createDiv(className, (div) => {
|
||||||
|
this.updateSettingEl(div, commandValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the setting display style in the setting tab
|
||||||
|
public updateSettingEl(element: HTMLElement, commandValue: boolean) {
|
||||||
|
element.style.borderTop = commandValue ? "1px solid var(--background-modifier-border)" : "none";
|
||||||
|
element.style.paddingTop = commandValue ? "0.75em" : "0";
|
||||||
|
element.style.display = commandValue ? "block" : "none";
|
||||||
|
element.style.alignItems = "center";
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to add one setting element in the setting tab.
|
||||||
|
public createSettingEl(contentEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any, dataRecord: string, settingsKey: string) {
|
||||||
|
if (type === 'password') {
|
||||||
|
return new Setting(contentEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addText((text) => {
|
||||||
|
text.inputEl.type = type;
|
||||||
|
return text
|
||||||
|
.setPlaceholder(placeholder)
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this[dataRecord][settingsKey] = value; // Update the settings dictionary await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
} else if (type === 'toggle') {
|
||||||
|
return new Setting(contentEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this[dataRecord][settingsKey] = value; // Update the settings dictionary await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else if (type === 'text') {
|
||||||
|
return new Setting(contentEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addText((text) =>
|
||||||
|
text
|
||||||
|
.setPlaceholder(placeholder)
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this[dataRecord][settingsKey] = value; // Update the settings dictionary await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,247 +1,307 @@
|
|||||||
import { App, PluginSettingTab, Setting } from "obsidian";
|
import { App, ButtonComponent, PluginSettingTab, Setting } from "obsidian";
|
||||||
import { i18nConfig } from "../lang/I18n";
|
import { i18nConfig } from "../lang/I18n";
|
||||||
import ObsidianSyncNotionPlugin from "../main";
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
|
import { SettingModal } from "./settingModal";
|
||||||
|
import { PreviewModal } from "./PreviewModal";
|
||||||
|
import { EditModal } from "./EditModal";
|
||||||
|
import { DeleteModal } from "./DeleteModal";
|
||||||
|
|
||||||
export interface PluginSettings {
|
export interface PluginSettings {
|
||||||
NextButton: boolean;
|
NextButton: boolean;
|
||||||
notionAPINext: string;
|
notionAPINext: string;
|
||||||
databaseIDNext: string;
|
databaseIDNext: string;
|
||||||
bannerUrl: string;
|
bannerUrl: string;
|
||||||
notionUser: string;
|
notionUser: string;
|
||||||
proxy: string;
|
NotionLinkDisplay: boolean;
|
||||||
GeneralButton: boolean;
|
proxy: string;
|
||||||
|
GeneralButton: boolean;
|
||||||
tagButton: boolean;
|
tagButton: boolean;
|
||||||
CustomTitleButton: boolean;
|
customTitleButton: boolean;
|
||||||
CustomTitleName: string;
|
customTitleName: string;
|
||||||
notionAPIGeneral: string;
|
notionAPIGeneral: string;
|
||||||
databaseIDGeneral: string;
|
databaseIDGeneral: string;
|
||||||
CustomButton: boolean;
|
CustomButton: boolean;
|
||||||
notionAPICustom: string;
|
CustomValues: string;
|
||||||
databaseIDCustom: string;
|
notionAPICustom: string;
|
||||||
[key: string]: any;
|
databaseIDCustom: string;
|
||||||
|
[key: string]: any;
|
||||||
|
databaseDetails: Record<string, DatabaseDetails>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DatabaseDetails {
|
||||||
|
format: string;
|
||||||
|
fullName: string;
|
||||||
|
abName: string;
|
||||||
|
notionAPI: string;
|
||||||
|
databaseID: string;
|
||||||
|
tagButton: boolean;
|
||||||
|
customTitleButton: boolean;
|
||||||
|
customTitleName: string;
|
||||||
|
customProperties: { customName: string, customType: string, index: number }[];
|
||||||
|
// customValues: string;
|
||||||
|
saved: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS: PluginSettings = {
|
export const DEFAULT_SETTINGS: PluginSettings = {
|
||||||
NextButton: true,
|
NextButton: true,
|
||||||
notionAPINext: "",
|
notionAPINext: "",
|
||||||
databaseIDNext: "",
|
databaseIDNext: "",
|
||||||
bannerUrl: "",
|
bannerUrl: "",
|
||||||
notionUser: "",
|
notionUser: "",
|
||||||
proxy: "",
|
NotionLinkDisplay: true,
|
||||||
GeneralButton: true,
|
proxy: "",
|
||||||
|
GeneralButton: true,
|
||||||
tagButton: true,
|
tagButton: true,
|
||||||
CustomTitleButton: false,
|
customTitleButton: false,
|
||||||
CustomTitleName: "",
|
customTitleName: "",
|
||||||
notionAPIGeneral: "",
|
notionAPIGeneral: "",
|
||||||
databaseIDGeneral: "",
|
databaseIDGeneral: "",
|
||||||
CustomButton: false,
|
CustomButton: false,
|
||||||
notionAPICustom: "",
|
CustomValues: "",
|
||||||
databaseIDCustom: "",
|
notionAPICustom: "",
|
||||||
|
databaseIDCustom: "",
|
||||||
|
databaseDetails: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export class ObsidianSettingTab extends PluginSettingTab {
|
export class ObsidianSettingTab extends PluginSettingTab {
|
||||||
plugin: ObsidianSyncNotionPlugin;
|
plugin: ObsidianSyncNotionPlugin;
|
||||||
|
databaseEl: HTMLDivElement;
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
// General Settings
|
// General Settings
|
||||||
containerEl.createEl('h2', { text: i18nConfig.GeneralSetting });
|
containerEl.createEl('h2', { text: i18nConfig.GeneralSetting });
|
||||||
|
|
||||||
this.createSettingEl(containerEl, i18nConfig.BannerUrl, i18nConfig.BannerUrlDesc, 'text', i18nConfig.BannerUrlText, this.plugin.settings.bannerUrl, 'bannerUrl')
|
this.createSettingEl(containerEl, i18nConfig.BannerUrl, i18nConfig.BannerUrlDesc, 'text', i18nConfig.BannerUrlText, this.plugin.settings.bannerUrl, 'bannerUrl')
|
||||||
|
|
||||||
this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser')
|
this.createSettingEl(containerEl, i18nConfig.NotionUser, i18nConfig.NotionUserDesc, 'text', i18nConfig.NotionUserText, this.plugin.settings.notionUser, 'notionUser')
|
||||||
|
|
||||||
containerEl.createEl('h2', { text: i18nConfig.NotionNextSettingHeader })
|
this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay')
|
||||||
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
// add new button
|
||||||
.setName(i18nConfig.NotionNextButton)
|
new Setting(containerEl)
|
||||||
.setDesc(i18nConfig.NotionNextButtonDesc)
|
.setName("Add New Database")
|
||||||
.addToggle((toggle) =>
|
.setDesc("Add New Database")
|
||||||
toggle
|
.addButton((button: ButtonComponent): ButtonComponent => {
|
||||||
.setValue(this.plugin.settings.NextButton)
|
return button
|
||||||
.onChange(async (value) => {
|
.setTooltip("Add New Database")
|
||||||
this.plugin.settings.NextButton = value;
|
.setIcon("plus")
|
||||||
|
.onClick(async () => {
|
||||||
|
let modal = new SettingModal(this.app, this.plugin, this);
|
||||||
|
|
||||||
this.updateSettingEl(notionAPINextEl, value)
|
modal.onClose = () => {
|
||||||
|
if (modal.data.saved) {
|
||||||
|
const dbDetails = {
|
||||||
|
format: modal.data.databaseFormat,
|
||||||
|
fullName: modal.data.databaseFullName,
|
||||||
|
abName: modal.data.databaseAbbreviateName,
|
||||||
|
notionAPI: modal.data.notionAPI,
|
||||||
|
databaseID: modal.data.databaseID,
|
||||||
|
tagButton: modal.data.tagButton,
|
||||||
|
customTitleButton: modal.data.customTitleButton,
|
||||||
|
customTitleName: modal.data.customTitleName,
|
||||||
|
customProperties: modal.data.customProperties,
|
||||||
|
// customValues: modal.data.customValues,
|
||||||
|
saved: modal.data.saved,
|
||||||
|
}
|
||||||
|
|
||||||
this.updateSettingEl(databaseIDNextEl, value)
|
this.plugin.addDatabaseDetails(dbDetails);
|
||||||
|
|
||||||
await this.plugin.saveSettings();
|
this.plugin.commands.updateCommand();
|
||||||
await this.plugin.commands.updateCommand();
|
|
||||||
})
|
this.display()
|
||||||
);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.open();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// new section to display all created database
|
||||||
|
containerEl.createEl('h2', { text: "Database List" });
|
||||||
|
|
||||||
|
this.databaseEl = containerEl.createDiv('database-list');
|
||||||
|
// list all created database
|
||||||
|
this.showDatabase();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a function to create a div with a style for pop over elements
|
||||||
|
// public createStyleDiv(className: string, commandValue: boolean = false) {
|
||||||
|
// return this.containerEl.createDiv(className, (div) => {
|
||||||
|
// this.updateSettingEl(div, commandValue);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// update the setting display style in the setting tab
|
||||||
|
public updateSettingEl(element: HTMLElement, commandValue: boolean) {
|
||||||
|
element.style.borderTop = commandValue ? "1px solid var(--background-modifier-border)" : "none";
|
||||||
|
element.style.paddingTop = commandValue ? "0.75em" : "0";
|
||||||
|
element.style.display = commandValue ? "block" : "none";
|
||||||
|
element.style.alignItems = "center";
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to add one setting element in the setting tab.
|
||||||
|
public createSettingEl(containerEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any, settingsKey: string) {
|
||||||
|
if (type === 'password') {
|
||||||
|
return new Setting(containerEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addText((text) => {
|
||||||
|
text.inputEl.type = type;
|
||||||
|
return text
|
||||||
|
.setPlaceholder(placeholder)
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
} else if (type === 'toggle') {
|
||||||
|
return new Setting(containerEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addToggle((toggle) =>
|
||||||
|
toggle
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
await this.plugin.commands.updateCommand();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else if (type === 'text') {
|
||||||
|
return new Setting(containerEl)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addText((text) =>
|
||||||
|
text
|
||||||
|
.setPlaceholder(placeholder)
|
||||||
|
.setValue(holderValue)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
await this.plugin.commands.updateCommand();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to show all the database details
|
||||||
|
showDatabase() {
|
||||||
|
this.databaseEl.empty();
|
||||||
|
|
||||||
|
for (let key in this.plugin.settings.databaseDetails) {
|
||||||
|
let dbDetails = this.plugin.settings.databaseDetails[key];
|
||||||
|
|
||||||
|
const databaseDiv = this.databaseEl.createDiv('database-div');
|
||||||
|
|
||||||
|
let settingEl = new Setting(databaseDiv)
|
||||||
|
.setName(`${dbDetails.fullName} (${dbDetails.abName})`)
|
||||||
|
.setDesc(dbDetails.format)
|
||||||
|
|
||||||
|
|
||||||
const notionAPINextEl = this.createStyleDiv('api-next', this.plugin.settings.NextButton)
|
// add a button for preview data
|
||||||
this.createSettingEl(notionAPINextEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPINext, 'notionAPINext')
|
settingEl
|
||||||
|
.addButton((button: ButtonComponent): ButtonComponent => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Preview Database")
|
||||||
|
.setIcon("eye")
|
||||||
|
.onClick(async () => {
|
||||||
|
let modal = new PreviewModal(this.app, this.plugin, this, dbDetails);
|
||||||
|
|
||||||
const databaseIDNextEl = this.createStyleDiv('databaseID-next', this.plugin.settings.NextButton)
|
modal.open();
|
||||||
this.createSettingEl(databaseIDNextEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDNext, 'databaseIDNext')
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// add a button for edit data
|
||||||
|
settingEl
|
||||||
|
.addButton((button: ButtonComponent): ButtonComponent => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Edit Database")
|
||||||
|
.setIcon("pencil")
|
||||||
|
.onClick(async () => {
|
||||||
|
let modal = new EditModal(this.app, this.plugin, this, dbDetails);
|
||||||
|
|
||||||
// General Database Settings
|
modal.onClose = () => {
|
||||||
containerEl.createEl('h2', { text: i18nConfig.NotionGeneralSettingHeader });
|
if (modal.dataTemp.savedTempInd) {
|
||||||
|
const dbDetailsNew: DatabaseDetails = {
|
||||||
|
format: modal.dataTemp.databaseFormatTemp,
|
||||||
|
fullName: modal.dataTemp.databaseFullNameTemp,
|
||||||
|
abName: modal.dataTemp.databaseAbbreviateNameTemp,
|
||||||
|
notionAPI: modal.dataTemp.notionAPITemp,
|
||||||
|
databaseID: modal.dataTemp.databaseIDTemp,
|
||||||
|
tagButton: modal.dataTemp.tagButtonTemp,
|
||||||
|
customTitleButton: modal.dataTemp.customTitleButtonTemp,
|
||||||
|
customTitleName: modal.dataTemp.customTitleNameTemp,
|
||||||
|
customProperties: modal.dataTemp.customPropertiesTemp,
|
||||||
|
// customValues: modal.data.customValues,
|
||||||
|
saved: modal.dataTemp.savedTemp,
|
||||||
|
}
|
||||||
|
|
||||||
// new Setting(containerEl)
|
const dbDetailsPrev: DatabaseDetails = {
|
||||||
// .setName(i18nConfig.NotYetFinish)
|
format: modal.dataPrev.databaseFormatPrev,
|
||||||
new Setting(containerEl)
|
fullName: modal.dataPrev.databaseFullNamePrev,
|
||||||
.setName(i18nConfig.NotionGeneralButton)
|
abName: modal.dataPrev.databaseAbbreviateNamePrev,
|
||||||
.setDesc(i18nConfig.NotionGeneralButtonDesc)
|
notionAPI: modal.dataPrev.notionAPIPrev,
|
||||||
.addToggle((toggle) =>
|
databaseID: modal.dataPrev.databaseIDPrev,
|
||||||
toggle
|
tagButton: modal.dataPrev.tagButtonPrev,
|
||||||
.setValue(this.plugin.settings.GeneralButton)
|
customTitleButton: modal.dataPrev.customTitleButtonPrev,
|
||||||
.onChange(async (value) => {
|
customTitleName: modal.dataPrev.customTitleNamePrev,
|
||||||
this.plugin.settings.GeneralButton = value;
|
customProperties: modal.dataPrev.customPropertiesPrev,
|
||||||
|
// customValues: modal.data.customValues,
|
||||||
|
saved: modal.dataPrev.savedPrev,
|
||||||
|
}
|
||||||
|
|
||||||
this.updateSettingEl(tagButtonEl, value)
|
this.plugin.deleteDatabaseDetails(dbDetailsPrev);
|
||||||
this.updateSettingEl(CustomTitleEl, value)
|
this.plugin.updateDatabaseDetails(dbDetailsNew);
|
||||||
// name should follow the result of the title button
|
|
||||||
if (value) {
|
|
||||||
this.updateSettingEl(CustomNameEl, this.plugin.settings.CustomTitleButton)
|
|
||||||
} else {
|
|
||||||
this.updateSettingEl(CustomNameEl, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateSettingEl(notionAPIGeneralEl, value)
|
this.plugin.commands.updateCommand();
|
||||||
this.updateSettingEl(databaseIDGeneralEl, value)
|
|
||||||
|
|
||||||
|
this.display()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await this.plugin.saveSettings();
|
modal.open();
|
||||||
await this.plugin.commands.updateCommand();
|
});
|
||||||
|
});
|
||||||
|
|
||||||
})
|
settingEl
|
||||||
);
|
.addButton((button: ButtonComponent): ButtonComponent => {
|
||||||
|
return button
|
||||||
|
.setTooltip("Delete Database")
|
||||||
|
.setIcon("trash")
|
||||||
|
.onClick(async () => {
|
||||||
|
let modal = new DeleteModal(this.app, this.plugin, this, dbDetails);
|
||||||
|
|
||||||
// add the tagButton to control whether to add tags to the general database
|
modal.onClose = () => {
|
||||||
const tagButtonEl = this.createStyleDiv('tag-button', (this.plugin.settings.GeneralButton && this.plugin.settings.CustomTitleButton));
|
if (modal.data.deleted) {
|
||||||
this.createSettingEl(tagButtonEl, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.plugin.settings.tagButton, 'tagButton')
|
this.plugin.deleteDatabaseDetails(dbDetails);
|
||||||
|
|
||||||
// Custom Title Button
|
console.log(dbDetails.fullName + " deleted");
|
||||||
const CustomTitleEl = this.createStyleDiv('custom-title', this.plugin.settings.GeneralButton);
|
|
||||||
new Setting(CustomTitleEl)
|
|
||||||
.setName(i18nConfig.NotionCustomTitle)
|
|
||||||
.setDesc(i18nConfig.NotionCustomTitleDesc)
|
|
||||||
.addToggle((toggle) =>
|
|
||||||
toggle
|
|
||||||
.setValue(this.plugin.settings.CustomTitleButton)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings.CustomTitleButton = value;
|
|
||||||
|
|
||||||
this.updateSettingEl(CustomNameEl, value)
|
this.plugin.commands.updateCommand();
|
||||||
|
|
||||||
await this.plugin.saveSettings();
|
this.display()
|
||||||
await this.plugin.commands.updateCommand();
|
}
|
||||||
})
|
}
|
||||||
);
|
|
||||||
|
|
||||||
// Custom Title Name
|
modal.open();
|
||||||
const CustomNameEl = this.createStyleDiv('custom-name', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
|
|
||||||
this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName, 'CustomTitleName')
|
|
||||||
|
|
||||||
// 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();
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
const notionAPIGeneralEl = this.createStyleDiv('api-general', this.plugin.settings.GeneralButton);
|
|
||||||
this.createSettingEl(notionAPIGeneralEl, i18nConfig.NotionAPI, i18nConfig.NotionAPIDesc, 'password', i18nConfig.NotionAPIText, this.plugin.settings.notionAPIGeneral, 'notionAPIGeneral')
|
|
||||||
|
|
||||||
|
|
||||||
const databaseIDGeneralEl = this.createStyleDiv('databaseID-general', this.plugin.settings.GeneralButton);
|
|
||||||
this.createSettingEl(databaseIDGeneralEl, i18nConfig.DatabaseID, i18nConfig.NotionAPIDesc, 'password', i18nConfig.DatabaseIDText, this.plugin.settings.databaseIDGeneral, 'databaseIDGeneral')
|
|
||||||
|
|
||||||
// Custom Database Settings
|
|
||||||
|
|
||||||
// containerEl.createEl('h2', {text: i18nConfig.NotionCustomSettingHeader});
|
|
||||||
//
|
|
||||||
// new Setting(containerEl)
|
|
||||||
// .setName(i18nConfig.NotionCustomButton)
|
|
||||||
// .setDesc(i18nConfig.NotionCustomButtonDesc)
|
|
||||||
// .addToggle((toggle) =>
|
|
||||||
// toggle
|
|
||||||
// .setValue(this.plugin.settings.CustomButton)
|
|
||||||
// .onChange(async (value) => {
|
|
||||||
// this.plugin.settings.CustomButton = value;
|
|
||||||
// await this.plugin.saveSettings();
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a function to create a div with a style for pop over elements
|
|
||||||
private createStyleDiv(className: string, commandValue: boolean = false) {
|
|
||||||
return this.containerEl.createDiv(className, (div) => {
|
|
||||||
this.updateSettingEl(div, commandValue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// update the setting display style in the setting tab
|
|
||||||
private updateSettingEl(element: HTMLElement, commandValue: boolean) {
|
|
||||||
element.style.borderTop = commandValue ? "1px solid var(--background-modifier-border)" : "none";
|
|
||||||
element.style.paddingTop = commandValue ? "0.75em" : "0";
|
|
||||||
element.style.display = commandValue ? "block" : "none";
|
|
||||||
element.style.alignItems = "center";
|
|
||||||
}
|
|
||||||
|
|
||||||
// function to add one setting element in the setting tab.
|
|
||||||
private createSettingEl(containerEl: HTMLElement, name: string, desc: string, type: string, placeholder: string, holderValue: any, settingsKey: string) {
|
|
||||||
if (type === 'password') {
|
|
||||||
return new Setting(containerEl)
|
|
||||||
.setName(name)
|
|
||||||
.setDesc(desc)
|
|
||||||
.addText((text) => {
|
|
||||||
text.inputEl.type = type;
|
|
||||||
return text
|
|
||||||
.setPlaceholder(placeholder)
|
|
||||||
.setValue(holderValue)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
})
|
|
||||||
});
|
|
||||||
} else if (type === 'toggle') {
|
|
||||||
return new Setting(containerEl)
|
|
||||||
.setName(name)
|
|
||||||
.setDesc(desc)
|
|
||||||
.addToggle((toggle) =>
|
|
||||||
toggle
|
|
||||||
.setValue(holderValue)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
await this.plugin.commands.updateCommand();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else if (type === 'text') {
|
|
||||||
return new Setting(containerEl)
|
|
||||||
.setName(name)
|
|
||||||
.setDesc(desc)
|
|
||||||
.addText((text) =>
|
|
||||||
text
|
|
||||||
.setPlaceholder(placeholder)
|
|
||||||
.setValue(holderValue)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
this.plugin.settings[settingsKey] = value; // Update the plugin settings directly
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
await this.plugin.commands.updateCommand();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { App, Notice, TFile } from "obsidian";
|
import { App, Notice, TFile } from "obsidian";
|
||||||
import ObsidianSyncNotionPlugin from "../main";
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
import { PluginSettings } from "../ui/settingTabs";
|
import { DatabaseDetails } from "../ui/settingTabs";
|
||||||
|
import { i18nConfig } from "src/lang/I18n";
|
||||||
|
|
||||||
export async function updateYamlInfo(
|
export async function updateYamlInfo(
|
||||||
yamlContent: string,
|
yamlContent: string,
|
||||||
@@ -8,10 +9,14 @@ export async function updateYamlInfo(
|
|||||||
res: any,
|
res: any,
|
||||||
app: App,
|
app: App,
|
||||||
plugin: ObsidianSyncNotionPlugin,
|
plugin: ObsidianSyncNotionPlugin,
|
||||||
|
dbDetails: DatabaseDetails,
|
||||||
) {
|
) {
|
||||||
let { url, id } = res.json
|
let { url, id } = res;
|
||||||
// replace www to notionID
|
// replace www to notionID
|
||||||
const { notionUser } = plugin.settings;
|
const { notionUser, NotionLinkDisplay } = plugin.settings;
|
||||||
|
const { abName } = dbDetails
|
||||||
|
const notionIDKey = `NotionID-${abName}`;
|
||||||
|
const linkKey = `link-${abName}`;
|
||||||
|
|
||||||
if (notionUser !== "") {
|
if (notionUser !== "") {
|
||||||
// replace url str "www" to notionID
|
// replace url str "www" to notionID
|
||||||
@@ -19,33 +24,21 @@ export async function updateYamlInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
||||||
if (yamlContent['notionID']) {
|
if (yamlContent[notionIDKey]) {
|
||||||
delete yamlContent['notionID']
|
delete yamlContent[notionIDKey]
|
||||||
}
|
}
|
||||||
if (yamlContent['link']) {
|
if (yamlContent[linkKey]) {
|
||||||
delete yamlContent['link']
|
delete yamlContent[linkKey]
|
||||||
}
|
}
|
||||||
// add new notionID and link
|
// add new notionID and link
|
||||||
yamlContent.notionID = id;
|
yamlContent[notionIDKey] = id;
|
||||||
yamlContent.link = url;
|
(NotionLinkDisplay) ? yamlContent[linkKey] = url : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(url)
|
await navigator.clipboard.writeText(url)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
new Notice(`复制链接失败,请手动复制${error}`)
|
console.log(error)
|
||||||
|
new Notice(`${i18nConfig.CopyErrorMessage}`);
|
||||||
}
|
}
|
||||||
// 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}`)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,79 +2,127 @@ import { i18nConfig } from "../lang/I18n";
|
|||||||
import { App, Notice } from "obsidian";
|
import { App, Notice } from "obsidian";
|
||||||
import { Upload2NotionNext } from "./upload_next/Upload2NotionNext";
|
import { Upload2NotionNext } from "./upload_next/Upload2NotionNext";
|
||||||
import { Upload2NotionGeneral } from "./upload_general/Upload2NotionGeneral";
|
import { Upload2NotionGeneral } from "./upload_general/Upload2NotionGeneral";
|
||||||
import { PluginSettings } from "../ui/settingTabs";
|
import { Upload2NotionCustom } from "./upoload_custom/Upload2NotionCustom";
|
||||||
|
import { DatabaseDetails, PluginSettings } from "../ui/settingTabs";
|
||||||
import ObsidianSyncNotionPlugin from "../main";
|
import ObsidianSyncNotionPlugin from "../main";
|
||||||
import { getNowFileMarkdownContentNext } from "./upload_next/getMarkdownNext";
|
import { getNowFileMarkdownContentNext } from "./upload_next/getMarkdownNext";
|
||||||
import { getNowFileMarkdownContentGeneral } from "./upload_general/getMarkdownGeneral";
|
import { getNowFileMarkdownContentGeneral } from "./upload_general/getMarkdownGeneral";
|
||||||
|
import { getNowFileMarkdownContentCustom } from "./upoload_custom/getMarkdownCustom";
|
||||||
|
|
||||||
export async function uploadCommandNext(
|
export async function uploadCommandNext(
|
||||||
plugin: ObsidianSyncNotionPlugin,
|
plugin: ObsidianSyncNotionPlugin,
|
||||||
settings: PluginSettings,
|
settings: PluginSettings,
|
||||||
app: App,
|
dbDetails: DatabaseDetails,
|
||||||
|
app: App,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const { notionAPINext, databaseIDNext } = settings;
|
const { notionAPI, databaseID } = dbDetails;
|
||||||
|
|
||||||
// Check if NNon exists
|
// Check if the user has set up the Notion API and database ID
|
||||||
// if (NNon === undefined) {
|
if (notionAPI === "" || databaseID === "") {
|
||||||
// const NNonmessage = i18nConfig.NNonMissing;
|
const setAPIMessage = i18nConfig["set-api-id"];
|
||||||
// new Notice(NNonmessage);
|
new Notice(setAPIMessage);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Check if the user has set up the Notion API and database ID
|
const {
|
||||||
if (notionAPINext === "" || databaseIDNext === "") {
|
markDownData,
|
||||||
const setAPIMessage = i18nConfig["set-api-id"];
|
nowFile,
|
||||||
new Notice(setAPIMessage);
|
emoji,
|
||||||
return;
|
cover,
|
||||||
}
|
tags,
|
||||||
|
type,
|
||||||
|
slug,
|
||||||
|
stats,
|
||||||
|
category,
|
||||||
|
summary,
|
||||||
|
paword,
|
||||||
|
favicon,
|
||||||
|
datetime
|
||||||
|
} = await getNowFileMarkdownContentNext(app, settings)
|
||||||
|
|
||||||
const { markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime } = await getNowFileMarkdownContentNext(app, settings)
|
if (markDownData) {
|
||||||
|
const { basename } = nowFile;
|
||||||
|
|
||||||
if (markDownData) {
|
const upload = new Upload2NotionNext(plugin, dbDetails);
|
||||||
const { basename } = nowFile;
|
const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app);
|
||||||
const upload = new Upload2NotionNext(plugin);
|
|
||||||
const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app);
|
|
||||||
|
|
||||||
if (res.status === 200) {
|
const { response } = res;
|
||||||
new Notice(`${i18nConfig["sync-success"]}${basename}`);
|
if (response.status === 200) {
|
||||||
} else {
|
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||||
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
|
} else {
|
||||||
}
|
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export async function uploadCommandGeneral(
|
export async function uploadCommandGeneral(
|
||||||
plugin: ObsidianSyncNotionPlugin,
|
plugin: ObsidianSyncNotionPlugin,
|
||||||
settings: PluginSettings,
|
settings: PluginSettings,
|
||||||
app: App,
|
dbDetails: DatabaseDetails,
|
||||||
|
app: App,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const { notionAPIGeneral, databaseIDGeneral } = settings;
|
const { notionAPI, databaseID } = dbDetails;
|
||||||
|
|
||||||
// Check if the user has set up the Notion API and database ID
|
// Check if the user has set up the Notion API and database ID
|
||||||
if (notionAPIGeneral === "" || databaseIDGeneral === "") {
|
if (notionAPI === "" || databaseID === "") {
|
||||||
const setAPIMessage = i18nConfig["set-api-id"];
|
const setAPIMessage = i18nConfig["set-api-id"];
|
||||||
new Notice(setAPIMessage);
|
new Notice(setAPIMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { markDownData, nowFile, cover, tags } = await getNowFileMarkdownContentGeneral(app, settings)
|
const { markDownData, nowFile, cover, tags } = await getNowFileMarkdownContentGeneral(app, settings)
|
||||||
|
|
||||||
if (markDownData) {
|
if (markDownData) {
|
||||||
const { basename } = nowFile;
|
const { basename } = nowFile;
|
||||||
|
|
||||||
const upload = new Upload2NotionGeneral(plugin);
|
const upload = new Upload2NotionGeneral(plugin, dbDetails);
|
||||||
const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app);
|
const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app);
|
||||||
|
|
||||||
if (res.status === 200) {
|
const { response } = res;
|
||||||
new Notice(`${i18nConfig["sync-success"]}${basename}`);
|
if (response.status === 200) {
|
||||||
} else {
|
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||||
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
|
} else {
|
||||||
}
|
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function uploadCommandCustom(
|
||||||
|
plugin: ObsidianSyncNotionPlugin,
|
||||||
|
settings: PluginSettings,
|
||||||
|
dbDetails: DatabaseDetails,
|
||||||
|
app: App,
|
||||||
|
) {
|
||||||
|
|
||||||
|
const { notionAPI, databaseID } = settings;
|
||||||
|
|
||||||
|
// Check if the user has set up the Notion API and database ID
|
||||||
|
if (notionAPI === "" || databaseID === "") {
|
||||||
|
const setAPIMessage = i18nConfig["set-api-id"];
|
||||||
|
new Notice(setAPIMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { markDownData, nowFile, cover, customValues } = await getNowFileMarkdownContentCustom(app, dbDetails)
|
||||||
|
|
||||||
|
if (markDownData) {
|
||||||
|
const { basename } = nowFile;
|
||||||
|
|
||||||
|
const upload = new Upload2NotionCustom(plugin, dbDetails);
|
||||||
|
const res = await upload.syncMarkdownToNotionCustom(cover, customValues, markDownData, nowFile, this.app);
|
||||||
|
|
||||||
|
const { response } = res;
|
||||||
|
if (response.status === 200) {
|
||||||
|
new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
|
||||||
|
} else {
|
||||||
|
new Notice(`${i18nConfig["sync-fail"]} ${basename}`, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,90 +1,96 @@
|
|||||||
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 "@jxpeng98/martian";
|
||||||
import * as yamlFrontMatter from "yaml-front-matter";
|
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";
|
||||||
|
import { DatabaseDetails } from "../../ui/settingTabs";
|
||||||
|
|
||||||
export class UploadBaseGeneral {
|
export class UploadBaseGeneral {
|
||||||
plugin: MyPlugin;
|
plugin: MyPlugin;
|
||||||
notion: Client;
|
notion: Client;
|
||||||
agent: any;
|
agent: any;
|
||||||
|
dbDetails: DatabaseDetails
|
||||||
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
this.dbDetails = dbDetails
|
||||||
|
}
|
||||||
|
|
||||||
async deletePage(notionID: string) {
|
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.notionAPINext,
|
|
||||||
'Notion-Version': '2022-06-28',
|
|
||||||
},
|
|
||||||
body: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getDataBase(databaseID: string) {
|
const { notionAPI } = this.dbDetails
|
||||||
const response = await requestUrl({
|
return requestUrl({
|
||||||
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
||||||
method: 'GET',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPINext,
|
'Content-Type': 'application/json',
|
||||||
'Notion-Version': '2022-06-28',
|
'Authorization': 'Bearer ' + notionAPI,
|
||||||
}
|
'Notion-Version': '2022-06-28',
|
||||||
}
|
},
|
||||||
)
|
body: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Check if cover is present in the JSON response and then get the URL
|
async getDataBase(databaseID: string) {
|
||||||
if (response.json.cover && response.json.cover.external) {
|
const { notionAPI } = this.dbDetails
|
||||||
return response.json.cover.external.url;
|
const response = await requestUrl({
|
||||||
} else {
|
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
||||||
return null; // or some other default value, if you prefer
|
method: 'GET',
|
||||||
}
|
headers: {
|
||||||
}
|
'Authorization': 'Bearer ' + notionAPI,
|
||||||
|
'Notion-Version': '2022-06-28',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// async updateYamlInfo(yamlContent: string, nowFile: TFile, res: any, app: App, settings: any) {
|
// Check if cover is present in the JSON response and then get the URL
|
||||||
// let {url, id} = res.json
|
if (response.json.cover && response.json.cover.external) {
|
||||||
// // replace www to notionID
|
return response.json.cover.external.url;
|
||||||
// const {notionUser} = this.plugin.settings;
|
} else {
|
||||||
//
|
return null; // or some other default value, if you prefer
|
||||||
// if (notionUser !== "") {
|
}
|
||||||
// // replace url str "www" to notionID
|
}
|
||||||
// url = url.replace("www.notion.so", `${notionUser}.notion.site`)
|
|
||||||
// }
|
// async updateYamlInfo(yamlContent: string, nowFile: TFile, res: any, app: App, settings: any) {
|
||||||
//
|
// let {url, id} = res.json
|
||||||
// await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
// // replace www to notionID
|
||||||
// if (yamlContent['notionID']) {
|
// const {notionUser} = this.plugin.settings;
|
||||||
// delete yamlContent['notionID']
|
//
|
||||||
// }
|
// if (notionUser !== "") {
|
||||||
// if (yamlContent['link']) {
|
// // replace url str "www" to notionID
|
||||||
// delete yamlContent['link']
|
// url = url.replace("www.notion.so", `${notionUser}.notion.site`)
|
||||||
// }
|
// }
|
||||||
// // add new notionID and link
|
//
|
||||||
// yamlContent.notionID = id;
|
// await app.fileManager.processFrontMatter(nowFile, yamlContent => {
|
||||||
// yamlContent.link = url;
|
// if (yamlContent['notionID']) {
|
||||||
// });
|
// delete yamlContent['notionID']
|
||||||
//
|
// }
|
||||||
// try {
|
// if (yamlContent['link']) {
|
||||||
// await navigator.clipboard.writeText(url)
|
// delete yamlContent['link']
|
||||||
// } catch (error) {
|
// }
|
||||||
// new Notice(`复制链接失败,请手动复制${error}`)
|
// // add new notionID and link
|
||||||
// }
|
// yamlContent.notionID = id;
|
||||||
// // const __content = yamlContent.__content;
|
// yamlContent.link = url;
|
||||||
// // delete yamlContent.__content
|
// });
|
||||||
// // const yamlhead = yaml.stringify(yamlContent)
|
//
|
||||||
// // // if yamlhead hava last \n remove it
|
// try {
|
||||||
// // const yamlhead_remove_n = yamlhead.replace(/\n$/, '')
|
// await navigator.clipboard.writeText(url)
|
||||||
// // // if __content have start \n remove it
|
// } catch (error) {
|
||||||
// // const __content_remove_n = __content.replace(/^\n/, '')
|
// new Notice(`复制链接失败,请手动复制${error}`)
|
||||||
// // const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_n;
|
// }
|
||||||
// // try {
|
// // const __content = yamlContent.__content;
|
||||||
// // await nowFile.vault.modify(nowFile, content)
|
// // delete yamlContent.__content
|
||||||
// // } catch (error) {
|
// // const yamlhead = yaml.stringify(yamlContent)
|
||||||
// // new Notice(`write file error ${error}`)
|
// // // 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}`)
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
import { App, Notice, requestUrl, TFile } from "obsidian";
|
import { App, Notice, TFile } from "obsidian";
|
||||||
import { Client } from "@notionhq/client";
|
import { Client } from "@notionhq/client";
|
||||||
import { markdownToBlocks } from "@tryfabric/martian";
|
import { markdownToBlocks } from "@jxpeng98/martian";
|
||||||
import * as yamlFrontMatter from "yaml-front-matter";
|
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";
|
||||||
import { PluginSettings } from "../../ui/settingTabs";
|
import { DatabaseDetails, PluginSettings } from "../../ui/settingTabs";
|
||||||
import { UploadBaseGeneral } from "./BaseUpload2NotionGeneral";
|
import { UploadBaseGeneral } from "./BaseUpload2NotionGeneral";
|
||||||
import { updateYamlInfo } from "../updateYaml";
|
import { updateYamlInfo } from "../updateYaml";
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
export class Upload2NotionGeneral extends UploadBaseGeneral {
|
export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||||
settings: PluginSettings;
|
settings: PluginSettings;
|
||||||
|
dbDetails: DatabaseDetails;
|
||||||
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
super(plugin);
|
super(plugin, dbDetails);
|
||||||
|
this.dbDetails = dbDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 因为需要解析notion的block进行对比,非常的麻烦,
|
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||||
@@ -26,12 +29,14 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
) {
|
) {
|
||||||
await this.deletePage(notionID);
|
await this.deletePage(notionID);
|
||||||
|
|
||||||
const databasecover = await this.getDataBase(
|
const { databaseID } = this.dbDetails;
|
||||||
this.plugin.settings.databaseIDGeneral,
|
|
||||||
|
const databaseCover = await this.getDataBase(
|
||||||
|
databaseID,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (cover == null) {
|
if (cover == null) {
|
||||||
cover = databasecover;
|
cover = databaseCover;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.createPage(title, cover, tags, childArr);
|
return await this.createPage(title, cover, tags, childArr);
|
||||||
@@ -43,13 +48,22 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
tags: string[],
|
tags: string[],
|
||||||
childArr: any,
|
childArr: any,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
const {
|
||||||
|
databaseID,
|
||||||
|
customTitleButton,
|
||||||
|
customTitleName,
|
||||||
|
tagButton,
|
||||||
|
notionAPI
|
||||||
|
} = this.dbDetails;
|
||||||
|
|
||||||
const bodyString: any = {
|
const bodyString: any = {
|
||||||
parent: {
|
parent: {
|
||||||
database_id: this.plugin.settings.databaseIDGeneral,
|
database_id: databaseID,
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
[this.plugin.settings.CustomTitleButton
|
[customTitleButton
|
||||||
? this.plugin.settings.CustomTitleName
|
? customTitleName
|
||||||
: "title"]: {
|
: "title"]: {
|
||||||
title: [
|
title: [
|
||||||
{
|
{
|
||||||
@@ -59,7 +73,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
...(this.plugin.settings.tagsButton
|
...(tagButton
|
||||||
? {
|
? {
|
||||||
tags: {
|
tags: {
|
||||||
multi_select: tags && true ? tags.map((tag) => ({ name: tag })) : [],
|
multi_select: tags && true ? tags.map((tag) => ({ name: tag })) : [],
|
||||||
@@ -88,21 +102,30 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
console.log(bodyString)
|
||||||
return await requestUrl({
|
|
||||||
url: `https://api.notion.com/v1/pages`,
|
const response = await fetch("https://api.notion.com/v1/pages", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
// 'User-Agent': 'obsidian.md',
|
"Authorization": "Bearer " + notionAPI,
|
||||||
Authorization:
|
"Notion-Version": "2022-06-28",
|
||||||
"Bearer " + this.plugin.settings.notionAPIGeneral,
|
},
|
||||||
"Notion-Version": "2022-06-28",
|
body: JSON.stringify(bodyString),
|
||||||
},
|
});
|
||||||
body: JSON.stringify(bodyString),
|
|
||||||
});
|
const data: any = await response.json();
|
||||||
} catch (error) {
|
if (!response.ok) {
|
||||||
new Notice(`network error ${error}`);
|
new Notice(`Error ${data.status}: ${data.code} \n Check the console for more information \n opt+cmd+i/ctrl+shift+i`, 5000);
|
||||||
|
console.log(`Error message: \n ${data.message}`);
|
||||||
|
} else {
|
||||||
|
console.log(`Page created: ${data.url}`);
|
||||||
|
console.log(`Page ID: ${data.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
response, // for status code
|
||||||
|
data // for id and url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +148,10 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
const file2Block = markdownToBlocks(__content, options);
|
const file2Block = markdownToBlocks(__content, options);
|
||||||
const frontmasster =
|
const frontmasster =
|
||||||
app.metadataCache.getFileCache(nowFile)?.frontmatter;
|
app.metadataCache.getFileCache(nowFile)?.frontmatter;
|
||||||
const notionID = frontmasster ? frontmasster.notionID : null;
|
const { abName } = this.dbDetails
|
||||||
|
const notionIDKey = `NotionID-${abName}`;
|
||||||
|
const notionID = frontmasster ? frontmasster[notionIDKey] : null;
|
||||||
|
|
||||||
|
|
||||||
if (notionID) {
|
if (notionID) {
|
||||||
res = await this.updatePage(
|
res = await this.updatePage(
|
||||||
@@ -138,11 +164,15 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
|||||||
} else {
|
} else {
|
||||||
res = await this.createPage(title, cover, tags, file2Block);
|
res = await this.createPage(title, cover, tags, file2Block);
|
||||||
}
|
}
|
||||||
if (res.status === 200) {
|
|
||||||
await updateYamlInfo(markdown, nowFile, res, app, this.plugin);
|
let {response, data} = res;
|
||||||
} else {
|
|
||||||
new Notice(`${res.text}`);
|
// console.log(response)
|
||||||
|
|
||||||
|
if (response && response.status === 200) {
|
||||||
|
await updateYamlInfo(markdown, nowFile, data, app, this.plugin, this.dbDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
import {App, Notice} from "obsidian";
|
import { App, Notice } from "obsidian";
|
||||||
import {i18nConfig} from "../../lang/I18n";
|
import { i18nConfig } from "../../lang/I18n";
|
||||||
import {PluginSettings} from "../../ui/settingTabs";
|
import { PluginSettings } from "../../ui/settingTabs";
|
||||||
|
|
||||||
export async function getNowFileMarkdownContentGeneral(
|
export async function getNowFileMarkdownContentGeneral(
|
||||||
app: App,
|
app: App,
|
||||||
settings: PluginSettings,
|
settings: PluginSettings,
|
||||||
) {
|
) {
|
||||||
const nowFile = app.workspace.getActiveFile();
|
const nowFile = app.workspace.getActiveFile();
|
||||||
let cover = '';
|
let cover = '';
|
||||||
let tags = [];
|
let tags = [];
|
||||||
|
|
||||||
const FileCache = app.metadataCache.getFileCache(nowFile);
|
const FileCache = app.metadataCache.getFileCache(nowFile);
|
||||||
try {
|
try {
|
||||||
cover = FileCache.frontmatter.coverurl;
|
cover = FileCache.frontmatter.coverurl;
|
||||||
tags = FileCache.frontmatter.tags;
|
tags = FileCache.frontmatter.tags;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
new Notice(i18nConfig["set-tags-fail"]);
|
new Notice(i18nConfig["set-tags-fail"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nowFile) {
|
if (nowFile) {
|
||||||
const markDownData = await nowFile.vault.read(nowFile);
|
const markDownData = await nowFile.vault.read(nowFile);
|
||||||
return {
|
return {
|
||||||
markDownData,
|
markDownData,
|
||||||
nowFile,
|
nowFile,
|
||||||
cover,
|
cover,
|
||||||
tags,
|
tags,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
new Notice(i18nConfig["open-file"]);
|
new Notice(i18nConfig["open-file"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
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 "@jxpeng98/martian";
|
||||||
import * as yamlFrontMatter from "yaml-front-matter";
|
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";
|
||||||
|
import { DatabaseDetails } from "../../ui/settingTabs";
|
||||||
|
|
||||||
export class UploadBaseNext {
|
export class UploadBaseNext {
|
||||||
plugin: MyPlugin;
|
plugin: MyPlugin;
|
||||||
notion: Client;
|
notion: Client;
|
||||||
agent: any;
|
agent: any;
|
||||||
|
dbDetails: DatabaseDetails
|
||||||
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.dbDetails = dbDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
async deletePage(notionID: string) {
|
async deletePage(notionID: string) {
|
||||||
|
const { notionAPI } = this.dbDetails
|
||||||
return requestUrl({
|
return requestUrl({
|
||||||
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPINext,
|
'Authorization': 'Bearer ' + notionAPI,
|
||||||
'Notion-Version': '2022-06-28',
|
'Notion-Version': '2022-06-28',
|
||||||
},
|
},
|
||||||
body: ''
|
body: ''
|
||||||
@@ -28,11 +32,13 @@ export class UploadBaseNext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getDataBase(databaseID: string) {
|
async getDataBase(databaseID: string) {
|
||||||
|
const { notionAPI } = this.dbDetails
|
||||||
|
|
||||||
const response = await requestUrl({
|
const response = await requestUrl({
|
||||||
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPINext,
|
'Authorization': 'Bearer ' + notionAPI,
|
||||||
'Notion-Version': '2022-06-28',
|
'Notion-Version': '2022-06-28',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { UploadBaseNext } from "./BaseUpload2NotionNext";
|
import { UploadBaseNext } from "./BaseUpload2NotionNext";
|
||||||
import { App, Notice, requestUrl, TFile } from "obsidian";
|
import { App, Notice, TFile } from "obsidian";
|
||||||
import { Client } from '@notionhq/client';
|
import { Client } from '@notionhq/client';
|
||||||
import { markdownToBlocks, } from "@tryfabric/martian";
|
import { markdownToBlocks, } from "@jxpeng98/martian";
|
||||||
import * as yamlFrontMatter from "yaml-front-matter";
|
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";
|
||||||
import { PluginSettings } from "../../ui/settingTabs";
|
import { DatabaseDetails, PluginSettings } from "../../ui/settingTabs";
|
||||||
import { updateYamlInfo } from "../updateYaml";
|
import { updateYamlInfo } from "../updateYaml";
|
||||||
|
import { LIMITS, paragraph } from "@jxpeng98/martian/src/notion";
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
export class Upload2NotionNext extends UploadBaseNext {
|
export class Upload2NotionNext extends UploadBaseNext {
|
||||||
settings: PluginSettings;
|
settings: PluginSettings;
|
||||||
|
dbDetails: DatabaseDetails
|
||||||
|
|
||||||
constructor(plugin: MyPlugin) {
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
super(plugin);
|
super(plugin, dbDetails);
|
||||||
|
this.dbDetails = dbDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
// 因为需要解析notion的block进行对比,非常的麻烦,
|
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||||
@@ -35,10 +39,12 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
) {
|
) {
|
||||||
await this.deletePage(notionID)
|
await this.deletePage(notionID)
|
||||||
|
|
||||||
const databasecover = await this.getDataBase(this.plugin.settings.databaseIDNext)
|
const { databaseID } = this.dbDetails
|
||||||
|
|
||||||
|
const databaseCover = await this.getDataBase(databaseID)
|
||||||
|
|
||||||
if (cover == null) {
|
if (cover == null) {
|
||||||
cover = databasecover
|
cover = databaseCover
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.createPage(
|
return await this.createPage(
|
||||||
@@ -72,12 +78,16 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
datetime: string,
|
datetime: string,
|
||||||
childArr: any
|
childArr: any
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
const {
|
||||||
|
databaseID,
|
||||||
|
notionAPI
|
||||||
|
} = this.dbDetails
|
||||||
|
|
||||||
|
|
||||||
const bodyString: any = {
|
const bodyString: any = {
|
||||||
parent: {
|
parent: {
|
||||||
database_id: this.plugin.settings.databaseIDNext
|
database_id: databaseID,
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
emoji: emoji || '📜'
|
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
@@ -89,25 +99,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'
|
||||||
@@ -118,15 +114,7 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
name: category || 'Obsidian'
|
name: category || 'Obsidian'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
summary: {
|
|
||||||
rich_text: [
|
|
||||||
{
|
|
||||||
text: {
|
|
||||||
content: summary || ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
password: {
|
password: {
|
||||||
rich_text: [
|
rich_text: [
|
||||||
{
|
{
|
||||||
@@ -153,6 +141,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",
|
||||||
@@ -171,21 +205,33 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
console.log(bodyString)
|
||||||
return await requestUrl({
|
|
||||||
url: `https://api.notion.com/v1/pages`,
|
const response = await fetch("https://api.notion.com/v1/pages", {
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
// 'User-Agent': 'obsidian.md',
|
"Authorization": "Bearer " + notionAPI,
|
||||||
'Authorization': 'Bearer ' + this.plugin.settings.notionAPINext,
|
"Notion-Version": "2022-06-28",
|
||||||
'Notion-Version': '2022-06-28',
|
},
|
||||||
},
|
body: JSON.stringify(bodyString),
|
||||||
body: JSON.stringify(bodyString),
|
});
|
||||||
})
|
|
||||||
} catch (error) {
|
const data: any = await response.json();
|
||||||
new Notice(`network error ${error}`)
|
|
||||||
}
|
// can use response.ok or response.status === 200
|
||||||
|
if (!response.ok) {
|
||||||
|
new Notice(`Error ${data.status}: ${data.code} \n Check the console for more information \n opt+cmd+i/ctrl+shift+i`, 5000);
|
||||||
|
console.log(`Error message: \n ${data.message}`);
|
||||||
|
} else {
|
||||||
|
console.log(`Page created: ${data.url}`);
|
||||||
|
console.log(`Page ID: ${data.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
response, // for status code
|
||||||
|
data // for id and url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async syncMarkdownToNotionNext(
|
async syncMarkdownToNotionNext(
|
||||||
@@ -205,17 +251,41 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
nowFile: TFile,
|
nowFile: TFile,
|
||||||
app: App,
|
app: App,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const options = {
|
const options = {
|
||||||
notionLimits: {
|
notionLimits: {
|
||||||
truncate: false,
|
truncate: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let res: any
|
let res: any
|
||||||
const yamlContent: any = yamlFrontMatter.loadFront(markdown);
|
const yamlContent: any = yamlFrontMatter.loadFront(markdown);
|
||||||
const __content = yamlContent.__content
|
const __content = yamlContent.__content
|
||||||
const file2Block = markdownToBlocks(__content, options);
|
const file2Block = markdownToBlocks(__content, options);
|
||||||
const frontmasster = app.metadataCache.getFileCache(nowFile)?.frontmatter
|
const frontmasster = app.metadataCache.getFileCache(nowFile)?.frontmatter
|
||||||
const notionID = frontmasster ? frontmasster.notionID : null
|
const { abName } = this.dbDetails
|
||||||
|
const notionIDKey = `NotionID-${abName}`;
|
||||||
|
const notionID = frontmasster ? frontmasster[notionIDKey] : null;
|
||||||
|
|
||||||
|
|
||||||
|
// increase the limits
|
||||||
|
// Motivated by https://github.com/tryfabric/martian/issues/51
|
||||||
|
file2Block.forEach((block, index) => {
|
||||||
|
if (
|
||||||
|
block.type === 'paragraph' &&
|
||||||
|
block.paragraph.rich_text.length > LIMITS.RICH_TEXT_ARRAYS
|
||||||
|
) {
|
||||||
|
|
||||||
|
const newParagraphBlocks: any[] = []
|
||||||
|
const chunk: any = []
|
||||||
|
const richTextChunks = chunk(block.paragraph.rich_text, 100)
|
||||||
|
|
||||||
|
richTextChunks.forEach((chunk: any) => {
|
||||||
|
newParagraphBlocks.push(paragraph(chunk))
|
||||||
|
})
|
||||||
|
|
||||||
|
file2Block.splice(index, 1, ...newParagraphBlocks)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (notionID) {
|
if (notionID) {
|
||||||
res = await this.updatePage(
|
res = await this.updatePage(
|
||||||
@@ -251,12 +321,14 @@ export class Upload2NotionNext extends UploadBaseNext {
|
|||||||
file2Block
|
file2Block
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (res.status === 200) {
|
|
||||||
await updateYamlInfo(markdown, nowFile, res, app, this.plugin)
|
let {response, data} = res;
|
||||||
} else {
|
|
||||||
new Notice(`${res.text}`)
|
if (response && response.status === 200) {
|
||||||
}
|
await updateYamlInfo(markdown, nowFile, data, app, this.plugin, this.dbDetails);
|
||||||
return res
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export async function getNowFileMarkdownContentNext(
|
|||||||
let type = '';
|
let type = '';
|
||||||
let slug = '';
|
let slug = '';
|
||||||
let stats = '';
|
let stats = '';
|
||||||
|
let status = '';
|
||||||
let category = '';
|
let category = '';
|
||||||
let summary = '';
|
let summary = '';
|
||||||
let paword = '';
|
let paword = '';
|
||||||
@@ -26,7 +27,7 @@ export async function getNowFileMarkdownContentNext(
|
|||||||
tags = FileCache.frontmatter.tags;
|
tags = FileCache.frontmatter.tags;
|
||||||
type = FileCache.frontmatter.type;
|
type = FileCache.frontmatter.type;
|
||||||
slug = FileCache.frontmatter.slug;
|
slug = FileCache.frontmatter.slug;
|
||||||
stats = FileCache.frontmatter.stats;
|
stats = FileCache.frontmatter.stats || FileCache.frontmatter.status;
|
||||||
category = FileCache.frontmatter.category;
|
category = FileCache.frontmatter.category;
|
||||||
summary = FileCache.frontmatter.summary;
|
summary = FileCache.frontmatter.summary;
|
||||||
paword = FileCache.frontmatter.password;
|
paword = FileCache.frontmatter.password;
|
||||||
|
|||||||
53
src/upload/upoload_custom/BaseUpload2NotionCustom.ts
Normal file
53
src/upload/upoload_custom/BaseUpload2NotionCustom.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import { App, Notice, requestUrl, TFile } from "obsidian";
|
||||||
|
import { Client } from '@notionhq/client';
|
||||||
|
import { markdownToBlocks, } from "@jxpeng98/martian";
|
||||||
|
import * as yamlFrontMatter from "yaml-front-matter";
|
||||||
|
// import * as yaml from "yaml"
|
||||||
|
import MyPlugin from "src/main";
|
||||||
|
import { DatabaseDetails } from "../../ui/settingTabs";
|
||||||
|
|
||||||
|
export class UploadBaseCustom {
|
||||||
|
plugin: MyPlugin;
|
||||||
|
notion: Client;
|
||||||
|
agent: any;
|
||||||
|
dbDetails: DatabaseDetails
|
||||||
|
|
||||||
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.dbDetails = dbDetails
|
||||||
|
}
|
||||||
|
|
||||||
|
async deletePage(notionID: string) {
|
||||||
|
const { notionAPI } = this.dbDetails
|
||||||
|
return requestUrl({
|
||||||
|
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + notionAPI,
|
||||||
|
'Notion-Version': '2022-06-28',
|
||||||
|
},
|
||||||
|
body: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataBase(databaseID: string) {
|
||||||
|
const { notionAPI } = this.dbDetails
|
||||||
|
const response = await requestUrl({
|
||||||
|
url: `https://api.notion.com/v1/databases/${databaseID}`,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
256
src/upload/upoload_custom/Upload2NotionCustom.ts
Normal file
256
src/upload/upoload_custom/Upload2NotionCustom.ts
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
import {App, Notice, TFile} from "obsidian";
|
||||||
|
import {markdownToBlocks} from "@jxpeng98/martian";
|
||||||
|
import * as yamlFrontMatter from "yaml-front-matter";
|
||||||
|
// import * as yaml from "yaml"
|
||||||
|
import MyPlugin from "src/main";
|
||||||
|
import {DatabaseDetails, PluginSettings} from "../../ui/settingTabs";
|
||||||
|
import {updateYamlInfo} from "../updateYaml";
|
||||||
|
import {UploadBaseCustom} from "./BaseUpload2NotionCustom";
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
|
|
||||||
|
export class Upload2NotionCustom extends UploadBaseCustom {
|
||||||
|
settings: PluginSettings;
|
||||||
|
dbDetails: DatabaseDetails;
|
||||||
|
|
||||||
|
constructor(plugin: MyPlugin, dbDetails: DatabaseDetails) {
|
||||||
|
super(plugin, dbDetails);
|
||||||
|
this.dbDetails = dbDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||||
|
// 暂时就直接删除,新建一个page
|
||||||
|
async updatePage(
|
||||||
|
notionID: string,
|
||||||
|
cover: string,
|
||||||
|
customValues: Record<string, string>,
|
||||||
|
childArr: any,
|
||||||
|
) {
|
||||||
|
await this.deletePage(notionID);
|
||||||
|
|
||||||
|
const {databaseID} = this.dbDetails;
|
||||||
|
|
||||||
|
const databaseCover = await this.getDataBase(
|
||||||
|
databaseID
|
||||||
|
);
|
||||||
|
|
||||||
|
if (cover == null) {
|
||||||
|
cover = databaseCover;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await this.createPage(cover, customValues, childArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createPage(
|
||||||
|
cover: string,
|
||||||
|
customValues: Record<string, string>,
|
||||||
|
childArr: any,
|
||||||
|
) {
|
||||||
|
|
||||||
|
const {
|
||||||
|
databaseID,
|
||||||
|
customProperties,
|
||||||
|
notionAPI
|
||||||
|
} = this.dbDetails;
|
||||||
|
|
||||||
|
const bodyString: any = this.buildBodyString(customProperties, customValues, 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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(bodyString)
|
||||||
|
|
||||||
|
const response = await fetch("https://api.notion.com/v1/pages", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Authorization": "Bearer " + notionAPI,
|
||||||
|
"Notion-Version": "2022-06-28",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(bodyString),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data: any = await response.json();
|
||||||
|
if (!response.ok) {
|
||||||
|
new Notice(`Error ${data.status}: ${data.code} \n Check the console for more information \n opt+cmd+i/ctrl+shift+i`, 5000);
|
||||||
|
console.log(`Error message: \n ${data.message}`);
|
||||||
|
} else {
|
||||||
|
console.log(`Page created: ${data.url}`);
|
||||||
|
console.log(`Page ID: ${data.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
response, // for status code
|
||||||
|
data // for id and url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async syncMarkdownToNotionCustom(
|
||||||
|
cover: string,
|
||||||
|
customValues: Record<string, string>,
|
||||||
|
markdown: string,
|
||||||
|
nowFile: TFile,
|
||||||
|
app: App,
|
||||||
|
): Promise<any> {
|
||||||
|
const options = {
|
||||||
|
strictImageUrls: true,
|
||||||
|
notionLimits: {
|
||||||
|
truncate: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let res: any;
|
||||||
|
const yamlContent: any = yamlFrontMatter.loadFront(markdown);
|
||||||
|
const __content = yamlContent.__content;
|
||||||
|
const file2Block = markdownToBlocks(__content, options);
|
||||||
|
const frontmasster =
|
||||||
|
app.metadataCache.getFileCache(nowFile)?.frontmatter;
|
||||||
|
const {abName} = this.dbDetails
|
||||||
|
const notionIDKey = `NotionID-${abName}`;
|
||||||
|
const notionID = frontmasster ? frontmasster[notionIDKey] : null;
|
||||||
|
|
||||||
|
if (notionID) {
|
||||||
|
res = await this.updatePage(
|
||||||
|
notionID,
|
||||||
|
cover,
|
||||||
|
customValues,
|
||||||
|
file2Block,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
res = await this.createPage(cover, customValues, file2Block);
|
||||||
|
}
|
||||||
|
|
||||||
|
let {response, data} = res;
|
||||||
|
|
||||||
|
// console.log(response)
|
||||||
|
|
||||||
|
if (response && response.status === 200) {
|
||||||
|
await updateYamlInfo(markdown, nowFile, data, app, this.plugin, this.dbDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildPropertyObject(customName: string, customType: string, customValues: Record<string, any>) {
|
||||||
|
const value = customValues[customName] || '';
|
||||||
|
|
||||||
|
switch (customType) {
|
||||||
|
case "title":
|
||||||
|
return {
|
||||||
|
title: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
case "rich_text":
|
||||||
|
return {
|
||||||
|
rich_text: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: value || '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
case "date":
|
||||||
|
return {
|
||||||
|
date: {
|
||||||
|
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: {
|
||||||
|
name: value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
case "multi_select":
|
||||||
|
return {
|
||||||
|
multi_select: Array.isArray(value) ? value.map(item => ({name: item})) : [{name: value}],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildBodyString(
|
||||||
|
customProperties: { customName: string; customType: string }[],
|
||||||
|
customValues: Record<string, string>,
|
||||||
|
childArr: any,
|
||||||
|
) {
|
||||||
|
|
||||||
|
const properties: { [key: string]: any } = {};
|
||||||
|
|
||||||
|
// Only include custom properties that have values
|
||||||
|
customProperties.forEach(({customName, customType}) => {
|
||||||
|
if (customValues[customName] !== undefined) {
|
||||||
|
properties[customName] = this.buildPropertyObject(customName, customType, customValues);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// console.log(properties)
|
||||||
|
|
||||||
|
return {
|
||||||
|
parent: {
|
||||||
|
database_id: this.dbDetails.databaseID,
|
||||||
|
},
|
||||||
|
properties,
|
||||||
|
children: childArr,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
57
src/upload/upoload_custom/getMarkdownCustom.ts
Normal file
57
src/upload/upoload_custom/getMarkdownCustom.ts
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import { App, Notice } from "obsidian";
|
||||||
|
import { i18nConfig } from "../../lang/I18n";
|
||||||
|
import { DatabaseDetails } from "../../ui/settingTabs";
|
||||||
|
|
||||||
|
export async function getNowFileMarkdownContentCustom(
|
||||||
|
app: App,
|
||||||
|
dbDetails: DatabaseDetails,
|
||||||
|
) {
|
||||||
|
const nowFile = app.workspace.getActiveFile();
|
||||||
|
if (!nowFile) {
|
||||||
|
new Notice(i18nConfig["open-file"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cover = '';
|
||||||
|
let customValues: Record<string, any> = {};
|
||||||
|
|
||||||
|
const FileCache = app.metadataCache.getFileCache(nowFile);
|
||||||
|
try {
|
||||||
|
cover = FileCache.frontmatter.coverurl;
|
||||||
|
|
||||||
|
// Get custom property names from dbDetails excluding the title type property
|
||||||
|
const customPropertyNames = dbDetails.customProperties
|
||||||
|
.filter(property => property.customType !== 'title') // Exclude 'title' type property
|
||||||
|
.map(property => property.customName);
|
||||||
|
|
||||||
|
// Extract custom values from the front matter based on the names
|
||||||
|
customPropertyNames.forEach(propertyName => {
|
||||||
|
if (FileCache.frontmatter && FileCache.frontmatter[propertyName] !== undefined) {
|
||||||
|
customValues[propertyName] = FileCache.frontmatter[propertyName];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if any of the customProperties has a customType of 'title'
|
||||||
|
const titleProperty = dbDetails.customProperties.find(property => property.customType === 'title');
|
||||||
|
|
||||||
|
// If a 'title' type property exists, use the file's basename as its value
|
||||||
|
if (titleProperty) {
|
||||||
|
customValues[titleProperty.customName] = nowFile.basename; // Use 'basename' for the file name without extension
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
new Notice(i18nConfig["set-tags-fail"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nowFile) {
|
||||||
|
const markDownData = await nowFile.vault.read(nowFile);
|
||||||
|
return {
|
||||||
|
markDownData,
|
||||||
|
nowFile,
|
||||||
|
cover,
|
||||||
|
customValues,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
new Notice(i18nConfig["open-file"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
|||||||
389
yarn.lock
389
yarn.lock
@@ -120,9 +120,20 @@
|
|||||||
eslint-visitor-keys "^3.3.0"
|
eslint-visitor-keys "^3.3.0"
|
||||||
|
|
||||||
"@eslint-community/regexpp@^4.5.1":
|
"@eslint-community/regexpp@^4.5.1":
|
||||||
version "4.10.0"
|
version "4.11.0"
|
||||||
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63"
|
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae"
|
||||||
integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==
|
integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==
|
||||||
|
|
||||||
|
"@jxpeng98/martian@^1.2.7":
|
||||||
|
version "1.2.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@jxpeng98/martian/-/martian-1.2.7.tgz#43c8e5403064eb0bae1afe44d0c369ecdd1b4888"
|
||||||
|
integrity sha512-SeGqHRUeDkCP9SEJt5sddXit+VVoGQhx/U1ePiqcww6dbK0gnv2CiDzfgtRkBFW8zoCBzkq50m/UBS0xz/VGig==
|
||||||
|
dependencies:
|
||||||
|
"@notionhq/client" "^1.0.4"
|
||||||
|
remark-gfm "^1.0.0"
|
||||||
|
remark-math "^4.0.0"
|
||||||
|
remark-parse "^9.0.0"
|
||||||
|
unified "^9.2.1"
|
||||||
|
|
||||||
"@nodelib/fs.scandir@2.1.5":
|
"@nodelib/fs.scandir@2.1.5":
|
||||||
version "2.1.5"
|
version "2.1.5"
|
||||||
@@ -153,17 +164,6 @@
|
|||||||
"@types/node-fetch" "^2.5.10"
|
"@types/node-fetch" "^2.5.10"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@tryfabric/martian@^1.2.4":
|
|
||||||
version "1.2.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@tryfabric/martian/-/martian-1.2.4.tgz#3fdfe7129f1c28bccddc34854cf353b0f37c0c02"
|
|
||||||
integrity sha512-g7SP7beaxrjxLnW//vskra07a1jsJowqp07KMouxh4gCwaF+ItHbRZN8O+1dhJivBi3VdasT71BPyk+8wzEreQ==
|
|
||||||
dependencies:
|
|
||||||
"@notionhq/client" "^1.0.4"
|
|
||||||
remark-gfm "^1.0.0"
|
|
||||||
remark-math "^4.0.0"
|
|
||||||
remark-parse "^9.0.0"
|
|
||||||
unified "^9.2.1"
|
|
||||||
|
|
||||||
"@types/codemirror@5.60.8":
|
"@types/codemirror@5.60.8":
|
||||||
version "5.60.8"
|
version "5.60.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/codemirror/-/codemirror-5.60.8.tgz#b647d04b470e8e1836dd84b2879988fc55c9de68"
|
resolved "https://registry.yarnpkg.com/@types/codemirror/-/codemirror-5.60.8.tgz#b647d04b470e8e1836dd84b2879988fc55c9de68"
|
||||||
@@ -184,9 +184,9 @@
|
|||||||
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
|
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==
|
||||||
|
|
||||||
"@types/hast@^3.0.0":
|
"@types/hast@^3.0.0":
|
||||||
version "3.0.3"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.3.tgz#7f75e6b43bc3f90316046a287d9ad3888309f7e1"
|
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.4.tgz#1d6b39993b82cea6ad783945b0508c25903e15aa"
|
||||||
integrity sha512-2fYGlaDy/qyLlhidX42wAH0KBi2TCjKMH8CHmBXgRlJ3Y+OXTiqsPQ6IWarZKwF1JoUcAJdPogv1d4b0COTpmQ==
|
integrity sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/unist" "*"
|
"@types/unist" "*"
|
||||||
|
|
||||||
@@ -201,9 +201,9 @@
|
|||||||
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
|
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
|
||||||
|
|
||||||
"@types/katex@^0.16.0":
|
"@types/katex@^0.16.0":
|
||||||
version "0.16.6"
|
version "0.16.7"
|
||||||
resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.16.6.tgz#6dd82f78a1a1d2eceeff6bb97ba98d7c062454cb"
|
resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.16.7.tgz#03ab680ab4fa4fbc6cb46ecf987ecad5d8019868"
|
||||||
integrity sha512-rZYO1HInM99rAFYNwGqbYPxHZHxu2IwZYKj4bJ4oh6edVrm1UId8mmbHIZLBtG253qU6y3piag0XYe/joNnwzQ==
|
integrity sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==
|
||||||
|
|
||||||
"@types/mdast@^3.0.0":
|
"@types/mdast@^3.0.0":
|
||||||
version "3.0.15"
|
version "3.0.15"
|
||||||
@@ -213,9 +213,9 @@
|
|||||||
"@types/unist" "^2"
|
"@types/unist" "^2"
|
||||||
|
|
||||||
"@types/mdast@^4.0.0":
|
"@types/mdast@^4.0.0":
|
||||||
version "4.0.3"
|
version "4.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.3.tgz#1e011ff013566e919a4232d1701ad30d70cab333"
|
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.4.tgz#7ccf72edd2f1aa7dd3437e180c64373585804dd6"
|
||||||
integrity sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg==
|
integrity sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/unist" "*"
|
"@types/unist" "*"
|
||||||
|
|
||||||
@@ -225,29 +225,29 @@
|
|||||||
integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==
|
integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==
|
||||||
|
|
||||||
"@types/node-fetch@^2.5.10":
|
"@types/node-fetch@^2.5.10":
|
||||||
version "2.6.9"
|
version "2.6.11"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e"
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.11.tgz#9b39b78665dae0e82a08f02f4967d62c66f95d24"
|
||||||
integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==
|
integrity sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
form-data "^4.0.0"
|
form-data "^4.0.0"
|
||||||
|
|
||||||
"@types/node@*", "@types/node@^20.5.7":
|
"@types/node@*", "@types/node@^20.5.7":
|
||||||
version "20.9.0"
|
version "20.14.12"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.12.tgz#129d7c3a822cb49fc7ff661235f19cfefd422b49"
|
||||||
integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==
|
integrity sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~5.26.4"
|
undici-types "~5.26.4"
|
||||||
|
|
||||||
"@types/semver@^7.5.0":
|
"@types/semver@^7.5.0":
|
||||||
version "7.5.5"
|
version "7.5.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.5.tgz#deed5ab7019756c9c90ea86139106b0346223f35"
|
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
|
||||||
integrity sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==
|
integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==
|
||||||
|
|
||||||
"@types/tern@*":
|
"@types/tern@*":
|
||||||
version "0.23.7"
|
version "0.23.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/tern/-/tern-0.23.7.tgz#f3c27fb7d6db5e86d7f069e7d5124bfa677a5b2d"
|
resolved "https://registry.yarnpkg.com/@types/tern/-/tern-0.23.9.tgz#6f6093a4a9af3e6bb8dde528e024924d196b367c"
|
||||||
integrity sha512-0YS9XCZ0LAhlP11HV9SqncUYyz9Ggsgc7Om/AmchKvoeFyj0qPaJmX6rJ93mJVExizWDzUMb49gAtVpI1uHd8Q==
|
integrity sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/estree" "*"
|
"@types/estree" "*"
|
||||||
|
|
||||||
@@ -269,16 +269,16 @@
|
|||||||
"@types/js-yaml" "*"
|
"@types/js-yaml" "*"
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
"@typescript-eslint/eslint-plugin@^6.11.0":
|
"@typescript-eslint/eslint-plugin@^6.16.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.11.0.tgz#52aae65174ff526576351f9ccd41cea01001463f"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3"
|
||||||
integrity sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w==
|
integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/regexpp" "^4.5.1"
|
"@eslint-community/regexpp" "^4.5.1"
|
||||||
"@typescript-eslint/scope-manager" "6.11.0"
|
"@typescript-eslint/scope-manager" "6.21.0"
|
||||||
"@typescript-eslint/type-utils" "6.11.0"
|
"@typescript-eslint/type-utils" "6.21.0"
|
||||||
"@typescript-eslint/utils" "6.11.0"
|
"@typescript-eslint/utils" "6.21.0"
|
||||||
"@typescript-eslint/visitor-keys" "6.11.0"
|
"@typescript-eslint/visitor-keys" "6.21.0"
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
graphemer "^1.4.0"
|
graphemer "^1.4.0"
|
||||||
ignore "^5.2.4"
|
ignore "^5.2.4"
|
||||||
@@ -286,78 +286,79 @@
|
|||||||
semver "^7.5.4"
|
semver "^7.5.4"
|
||||||
ts-api-utils "^1.0.1"
|
ts-api-utils "^1.0.1"
|
||||||
|
|
||||||
"@typescript-eslint/parser@^6.11.0":
|
"@typescript-eslint/parser@^6.16.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.11.0.tgz#9640d9595d905f3be4f278bf515130e6129b202e"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b"
|
||||||
integrity sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==
|
integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/scope-manager" "6.11.0"
|
"@typescript-eslint/scope-manager" "6.21.0"
|
||||||
"@typescript-eslint/types" "6.11.0"
|
"@typescript-eslint/types" "6.21.0"
|
||||||
"@typescript-eslint/typescript-estree" "6.11.0"
|
"@typescript-eslint/typescript-estree" "6.21.0"
|
||||||
"@typescript-eslint/visitor-keys" "6.11.0"
|
"@typescript-eslint/visitor-keys" "6.21.0"
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
|
|
||||||
"@typescript-eslint/scope-manager@6.11.0":
|
"@typescript-eslint/scope-manager@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz#621f603537c89f4d105733d949aa4d55eee5cea8"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1"
|
||||||
integrity sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==
|
integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "6.11.0"
|
"@typescript-eslint/types" "6.21.0"
|
||||||
"@typescript-eslint/visitor-keys" "6.11.0"
|
"@typescript-eslint/visitor-keys" "6.21.0"
|
||||||
|
|
||||||
"@typescript-eslint/type-utils@6.11.0":
|
"@typescript-eslint/type-utils@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.11.0.tgz#d0b8b1ab6c26b974dbf91de1ebc5b11fea24e0d1"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e"
|
||||||
integrity sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA==
|
integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/typescript-estree" "6.11.0"
|
"@typescript-eslint/typescript-estree" "6.21.0"
|
||||||
"@typescript-eslint/utils" "6.11.0"
|
"@typescript-eslint/utils" "6.21.0"
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
ts-api-utils "^1.0.1"
|
ts-api-utils "^1.0.1"
|
||||||
|
|
||||||
"@typescript-eslint/types@6.11.0":
|
"@typescript-eslint/types@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.11.0.tgz#8ad3aa000cbf4bdc4dcceed96e9b577f15e0bf53"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d"
|
||||||
integrity sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==
|
integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree@6.11.0":
|
"@typescript-eslint/typescript-estree@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz#7b52c12a623bf7f8ec7f8a79901b9f98eb5c7990"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46"
|
||||||
integrity sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==
|
integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "6.11.0"
|
"@typescript-eslint/types" "6.21.0"
|
||||||
"@typescript-eslint/visitor-keys" "6.11.0"
|
"@typescript-eslint/visitor-keys" "6.21.0"
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
globby "^11.1.0"
|
globby "^11.1.0"
|
||||||
is-glob "^4.0.3"
|
is-glob "^4.0.3"
|
||||||
|
minimatch "9.0.3"
|
||||||
semver "^7.5.4"
|
semver "^7.5.4"
|
||||||
ts-api-utils "^1.0.1"
|
ts-api-utils "^1.0.1"
|
||||||
|
|
||||||
"@typescript-eslint/utils@6.11.0":
|
"@typescript-eslint/utils@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.11.0.tgz#11374f59ef4cea50857b1303477c08aafa2ca604"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134"
|
||||||
integrity sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==
|
integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/eslint-utils" "^4.4.0"
|
"@eslint-community/eslint-utils" "^4.4.0"
|
||||||
"@types/json-schema" "^7.0.12"
|
"@types/json-schema" "^7.0.12"
|
||||||
"@types/semver" "^7.5.0"
|
"@types/semver" "^7.5.0"
|
||||||
"@typescript-eslint/scope-manager" "6.11.0"
|
"@typescript-eslint/scope-manager" "6.21.0"
|
||||||
"@typescript-eslint/types" "6.11.0"
|
"@typescript-eslint/types" "6.21.0"
|
||||||
"@typescript-eslint/typescript-estree" "6.11.0"
|
"@typescript-eslint/typescript-estree" "6.21.0"
|
||||||
semver "^7.5.4"
|
semver "^7.5.4"
|
||||||
|
|
||||||
"@typescript-eslint/visitor-keys@6.11.0":
|
"@typescript-eslint/visitor-keys@6.21.0":
|
||||||
version "6.11.0"
|
version "6.21.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz#d991538788923f92ec40d44389e7075b359f3458"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47"
|
||||||
integrity sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==
|
integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "6.11.0"
|
"@typescript-eslint/types" "6.21.0"
|
||||||
eslint-visitor-keys "^3.4.1"
|
eslint-visitor-keys "^3.4.1"
|
||||||
|
|
||||||
agent-base@^7.0.2:
|
agent-base@^7.0.2:
|
||||||
version "7.1.0"
|
version "7.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317"
|
||||||
integrity sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==
|
integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
|
|
||||||
@@ -388,14 +389,26 @@ bail@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d"
|
resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d"
|
||||||
integrity sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==
|
integrity sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==
|
||||||
|
|
||||||
braces@^3.0.2:
|
balanced-match@^1.0.0:
|
||||||
version "3.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||||
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
|
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||||
dependencies:
|
|
||||||
fill-range "^7.0.1"
|
|
||||||
|
|
||||||
builtin-modules@^3.2.0:
|
brace-expansion@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
|
||||||
|
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
|
||||||
|
braces@^3.0.3:
|
||||||
|
version "3.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
|
||||||
|
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
|
||||||
|
dependencies:
|
||||||
|
fill-range "^7.1.1"
|
||||||
|
|
||||||
|
builtin-modules@^3.3.0:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
|
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
|
||||||
integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==
|
integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==
|
||||||
@@ -447,10 +460,15 @@ commander@^8.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
||||||
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
||||||
|
|
||||||
|
data-uri-to-buffer@^4.0.0:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
|
||||||
|
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==
|
||||||
|
|
||||||
debug@4, debug@^4.0.0, debug@^4.3.4:
|
debug@4, debug@^4.0.0, debug@^4.3.4:
|
||||||
version "4.3.4"
|
version "4.3.6"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b"
|
||||||
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
|
||||||
dependencies:
|
dependencies:
|
||||||
ms "2.1.2"
|
ms "2.1.2"
|
||||||
|
|
||||||
@@ -545,16 +563,24 @@ fast-glob@^3.2.9:
|
|||||||
micromatch "^4.0.4"
|
micromatch "^4.0.4"
|
||||||
|
|
||||||
fastq@^1.6.0:
|
fastq@^1.6.0:
|
||||||
version "1.15.0"
|
version "1.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a"
|
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47"
|
||||||
integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==
|
integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==
|
||||||
dependencies:
|
dependencies:
|
||||||
reusify "^1.0.4"
|
reusify "^1.0.4"
|
||||||
|
|
||||||
fill-range@^7.0.1:
|
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
|
||||||
version "7.0.1"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
|
||||||
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
|
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
|
||||||
|
dependencies:
|
||||||
|
node-domexception "^1.0.0"
|
||||||
|
web-streams-polyfill "^3.0.3"
|
||||||
|
|
||||||
|
fill-range@^7.1.1:
|
||||||
|
version "7.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
|
||||||
|
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
|
||||||
dependencies:
|
dependencies:
|
||||||
to-regex-range "^5.0.1"
|
to-regex-range "^5.0.1"
|
||||||
|
|
||||||
@@ -567,6 +593,13 @@ form-data@^4.0.0:
|
|||||||
combined-stream "^1.0.8"
|
combined-stream "^1.0.8"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
|
formdata-polyfill@^4.0.10:
|
||||||
|
version "4.0.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
|
||||||
|
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
|
||||||
|
dependencies:
|
||||||
|
fetch-blob "^3.1.2"
|
||||||
|
|
||||||
glob-parent@^5.1.2:
|
glob-parent@^5.1.2:
|
||||||
version "5.1.2"
|
version "5.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||||
@@ -592,17 +625,17 @@ graphemer@^1.4.0:
|
|||||||
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
|
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
|
||||||
|
|
||||||
https-proxy-agent@^7.0.2:
|
https-proxy-agent@^7.0.2:
|
||||||
version "7.0.2"
|
version "7.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b"
|
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2"
|
||||||
integrity sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==
|
integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base "^7.0.2"
|
agent-base "^7.0.2"
|
||||||
debug "4"
|
debug "4"
|
||||||
|
|
||||||
ignore@^5.2.0, ignore@^5.2.4:
|
ignore@^5.2.0, ignore@^5.2.4:
|
||||||
version "5.3.0"
|
version "5.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78"
|
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
|
||||||
integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==
|
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==
|
||||||
|
|
||||||
is-alphabetical@^1.0.0:
|
is-alphabetical@^1.0.0:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
@@ -675,9 +708,9 @@ katex@^0.12.0:
|
|||||||
commander "^2.19.0"
|
commander "^2.19.0"
|
||||||
|
|
||||||
katex@^0.16.0:
|
katex@^0.16.0:
|
||||||
version "0.16.9"
|
version "0.16.11"
|
||||||
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.9.tgz#bc62d8f7abfea6e181250f85a56e4ef292dcb1fa"
|
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.11.tgz#4bc84d5584f996abece5f01c6ad11304276a33f5"
|
||||||
integrity sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==
|
integrity sha512-RQrI8rlHY92OLf3rho/Ts8i/XvjgguEjOkO1BEXcU3N8BqPpSzBNwV/G0Ukr+P/l3ivvJUE/Fa/CwbS6HesGNQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
commander "^8.3.0"
|
commander "^8.3.0"
|
||||||
|
|
||||||
@@ -691,13 +724,6 @@ longest-streak@^3.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-3.1.0.tgz#62fa67cd958742a1574af9f39866364102d90cd4"
|
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-3.1.0.tgz#62fa67cd958742a1574af9f39866364102d90cd4"
|
||||||
integrity sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==
|
integrity sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==
|
||||||
|
|
||||||
lru-cache@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
|
||||||
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
|
||||||
dependencies:
|
|
||||||
yallist "^4.0.0"
|
|
||||||
|
|
||||||
markdown-table@^2.0.0:
|
markdown-table@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b"
|
resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b"
|
||||||
@@ -726,9 +752,9 @@ mdast-util-from-markdown@^0.8.0:
|
|||||||
unist-util-stringify-position "^2.0.0"
|
unist-util-stringify-position "^2.0.0"
|
||||||
|
|
||||||
mdast-util-from-markdown@^2.0.0:
|
mdast-util-from-markdown@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz#52f14815ec291ed061f2922fd14d6689c810cb88"
|
resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.1.tgz#32a6e8f512b416e1f51eb817fc64bd867ebcd9cc"
|
||||||
integrity sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==
|
integrity sha512-aJEUyzZ6TzlsX2s5B4Of7lN7EQtAxvtradMMglCQDyaTFgse6CmtmdJ15ElnVRlCg1vpNyVtbem0PWzlNieZsA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/mdast" "^4.0.0"
|
"@types/mdast" "^4.0.0"
|
||||||
"@types/unist" "^3.0.0"
|
"@types/unist" "^3.0.0"
|
||||||
@@ -808,9 +834,9 @@ mdast-util-math@^3.0.0:
|
|||||||
unist-util-remove-position "^5.0.0"
|
unist-util-remove-position "^5.0.0"
|
||||||
|
|
||||||
mdast-util-phrasing@^4.0.0:
|
mdast-util-phrasing@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-4.0.0.tgz#468cbbb277375523de807248b8ad969feb02a5c7"
|
resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz#7cc0a8dec30eaf04b7b1a9661a92adb3382aa6e3"
|
||||||
integrity sha512-xadSsJayQIucJ9n053dfQwVu1kuXg7jCTdYsMK8rqzKZh52nLfSH/k0sAxE0u+pj/zKZX+o5wB+ML5mRayOxFA==
|
integrity sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/mdast" "^4.0.0"
|
"@types/mdast" "^4.0.0"
|
||||||
unist-util-is "^6.0.0"
|
unist-util-is "^6.0.0"
|
||||||
@@ -859,9 +885,9 @@ merge2@^1.3.0, merge2@^1.4.1:
|
|||||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||||
|
|
||||||
micromark-core-commonmark@^2.0.0:
|
micromark-core-commonmark@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-2.0.0.tgz#50740201f0ee78c12a675bf3e68ffebc0bf931a3"
|
resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-2.0.1.tgz#9a45510557d068605c6e9a80f282b2bb8581e43d"
|
||||||
integrity sha512-jThOz/pVmAYUtkroV3D5c1osFXAMv9e0ypGDOIZuCeAe91/sD6BoE2Sjzt30yuXtwOYUmySOhMas/PVyh02itA==
|
integrity sha512-CUQyKr1e///ZODyD1U3xit6zXwy1a8q2a1S1HKtIlmgvurrEpaw/Y9y6KSIbF8P59cn/NjzHyO+Q2fAyYLQrAA==
|
||||||
dependencies:
|
dependencies:
|
||||||
decode-named-character-reference "^1.0.0"
|
decode-named-character-reference "^1.0.0"
|
||||||
devlop "^1.0.0"
|
devlop "^1.0.0"
|
||||||
@@ -934,9 +960,9 @@ micromark-extension-math@^0.1.0:
|
|||||||
micromark "~2.11.0"
|
micromark "~2.11.0"
|
||||||
|
|
||||||
micromark-extension-math@^3.0.0:
|
micromark-extension-math@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/micromark-extension-math/-/micromark-extension-math-3.0.0.tgz#c7a47d6ce990812243ad3946a30bb60e4c2a8c76"
|
resolved "https://registry.yarnpkg.com/micromark-extension-math/-/micromark-extension-math-3.1.0.tgz#c42ee3b1dd5a9a03584e83dd8f08e3de510212c1"
|
||||||
integrity sha512-iJ2Q28vBoEovLN5o3GO12CpqorQRYDPT+p4zW50tGwTfJB+iv/VnB6Ini+gqa24K97DwptMBBIvVX6Bjk49oyQ==
|
integrity sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/katex" "^0.16.0"
|
"@types/katex" "^0.16.0"
|
||||||
devlop "^1.0.0"
|
devlop "^1.0.0"
|
||||||
@@ -994,9 +1020,9 @@ micromark-factory-whitespace@^2.0.0:
|
|||||||
micromark-util-types "^2.0.0"
|
micromark-util-types "^2.0.0"
|
||||||
|
|
||||||
micromark-util-character@^2.0.0:
|
micromark-util-character@^2.0.0:
|
||||||
version "2.0.1"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.0.1.tgz#52b824c2e2633b6fb33399d2ec78ee2a90d6b298"
|
resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.1.0.tgz#31320ace16b4644316f6bf057531689c71e2aee1"
|
||||||
integrity sha512-3wgnrmEAJ4T+mGXAUfMvMAbxU9RDG43XmGce4j6CwPtVxB3vfwXSZ6KhFwDzZ3mZHhmPimMAXg71veiBGzeAZw==
|
integrity sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
micromark-util-symbol "^2.0.0"
|
micromark-util-symbol "^2.0.0"
|
||||||
micromark-util-types "^2.0.0"
|
micromark-util-types "^2.0.0"
|
||||||
@@ -1076,9 +1102,9 @@ micromark-util-sanitize-uri@^2.0.0:
|
|||||||
micromark-util-symbol "^2.0.0"
|
micromark-util-symbol "^2.0.0"
|
||||||
|
|
||||||
micromark-util-subtokenize@^2.0.0:
|
micromark-util-subtokenize@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.0.tgz#9f412442d77e0c5789ffdf42377fa8a2bcbdf581"
|
resolved "https://registry.yarnpkg.com/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.1.tgz#76129c49ac65da6e479c09d0ec4b5f29ec6eace5"
|
||||||
integrity sha512-vc93L1t+gpR3p8jxeVdaYlbV2jTYteDje19rNSS/H5dlhxUYll5Fy6vJ2cDwP8RnsXi818yGty1ayP55y3W6fg==
|
integrity sha512-jZNtiFl/1aY73yS3UGQkutD0UbhTt68qnRpw2Pifmz5wV9h8gOVsN70v+Lq/f1rKaU/W8pxRe8y8Q9FX1AOe1Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
devlop "^1.0.0"
|
devlop "^1.0.0"
|
||||||
micromark-util-chunked "^2.0.0"
|
micromark-util-chunked "^2.0.0"
|
||||||
@@ -1127,11 +1153,11 @@ micromark@^4.0.0:
|
|||||||
micromark-util-types "^2.0.0"
|
micromark-util-types "^2.0.0"
|
||||||
|
|
||||||
micromatch@^4.0.4:
|
micromatch@^4.0.4:
|
||||||
version "4.0.5"
|
version "4.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5"
|
||||||
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
|
integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
braces "^3.0.2"
|
braces "^3.0.3"
|
||||||
picomatch "^2.3.1"
|
picomatch "^2.3.1"
|
||||||
|
|
||||||
mime-db@1.52.0:
|
mime-db@1.52.0:
|
||||||
@@ -1146,6 +1172,13 @@ mime-types@^2.1.12:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mime-db "1.52.0"
|
mime-db "1.52.0"
|
||||||
|
|
||||||
|
minimatch@9.0.3:
|
||||||
|
version "9.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
|
||||||
|
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^2.0.1"
|
||||||
|
|
||||||
moment@2.29.4:
|
moment@2.29.4:
|
||||||
version "2.29.4"
|
version "2.29.4"
|
||||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
|
||||||
@@ -1161,6 +1194,11 @@ natural-compare@^1.4.0:
|
|||||||
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||||
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
|
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
|
||||||
|
|
||||||
|
node-domexception@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
||||||
|
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
||||||
|
|
||||||
node-fetch@^2.6.1:
|
node-fetch@^2.6.1:
|
||||||
version "2.7.0"
|
version "2.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
||||||
@@ -1168,10 +1206,19 @@ node-fetch@^2.6.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
whatwg-url "^5.0.0"
|
whatwg-url "^5.0.0"
|
||||||
|
|
||||||
obsidian@latest:
|
node-fetch@^3.3.2:
|
||||||
version "1.4.11"
|
version "3.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/obsidian/-/obsidian-1.4.11.tgz#5cba594c83a74ebad58b630c610265018abdadaa"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
|
||||||
integrity sha512-BCVYTvaXxElJMl6MMbDdY/CGK+aq18SdtDY/7vH8v6BxCBQ6KF4kKxL0vG9UZ0o5qh139KpUoJHNm+6O5dllKA==
|
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
|
||||||
|
dependencies:
|
||||||
|
data-uri-to-buffer "^4.0.0"
|
||||||
|
fetch-blob "^3.1.4"
|
||||||
|
formdata-polyfill "^4.0.10"
|
||||||
|
|
||||||
|
obsidian@^1.6.6:
|
||||||
|
version "1.6.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/obsidian/-/obsidian-1.6.6.tgz#d45c4021c291765e1b77ed4a1c645e562ff6e77f"
|
||||||
|
integrity sha512-GZHzeOiwmw/wBjB5JwrsxAZBLqxGQmqtEKSvJJvT0LtTcqeOFnV8jv0ZK5kO7hBb44WxJc+LdS7mZgLXbb+qXQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/codemirror" "5.60.8"
|
"@types/codemirror" "5.60.8"
|
||||||
moment "2.29.4"
|
moment "2.29.4"
|
||||||
@@ -1259,11 +1306,9 @@ run-parallel@^1.1.9:
|
|||||||
queue-microtask "^1.2.2"
|
queue-microtask "^1.2.2"
|
||||||
|
|
||||||
semver@^7.5.4:
|
semver@^7.5.4:
|
||||||
version "7.5.4"
|
version "7.6.3"
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
|
||||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
|
||||||
dependencies:
|
|
||||||
lru-cache "^6.0.0"
|
|
||||||
|
|
||||||
slash@^3.0.0:
|
slash@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
@@ -1293,14 +1338,14 @@ trough@^1.0.0:
|
|||||||
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
|
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
|
||||||
|
|
||||||
trough@^2.0.0:
|
trough@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/trough/-/trough-2.1.0.tgz#0f7b511a4fde65a46f18477ab38849b22c554876"
|
resolved "https://registry.yarnpkg.com/trough/-/trough-2.2.0.tgz#94a60bd6bd375c152c1df911a4b11d5b0256f50f"
|
||||||
integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==
|
integrity sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==
|
||||||
|
|
||||||
ts-api-utils@^1.0.1:
|
ts-api-utils@^1.0.1:
|
||||||
version "1.0.3"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
|
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1"
|
||||||
integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==
|
integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==
|
||||||
|
|
||||||
tslib@2.6.2:
|
tslib@2.6.2:
|
||||||
version "2.6.2"
|
version "2.6.2"
|
||||||
@@ -1318,9 +1363,9 @@ undici-types@~5.26.4:
|
|||||||
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
|
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
|
||||||
|
|
||||||
unified@^11.0.0:
|
unified@^11.0.0:
|
||||||
version "11.0.4"
|
version "11.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.4.tgz#f4be0ac0fe4c88cb873687c07c64c49ed5969015"
|
resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.5.tgz#f66677610a5c0a9ee90cab2b8d4d66037026d9e1"
|
||||||
integrity sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ==
|
integrity sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/unist" "^3.0.0"
|
"@types/unist" "^3.0.0"
|
||||||
bail "^2.0.0"
|
bail "^2.0.0"
|
||||||
@@ -1428,14 +1473,19 @@ vfile@^4.0.0:
|
|||||||
vfile-message "^2.0.0"
|
vfile-message "^2.0.0"
|
||||||
|
|
||||||
vfile@^6.0.0:
|
vfile@^6.0.0:
|
||||||
version "6.0.1"
|
version "6.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/vfile/-/vfile-6.0.1.tgz#1e8327f41eac91947d4fe9d237a2dd9209762536"
|
resolved "https://registry.yarnpkg.com/vfile/-/vfile-6.0.2.tgz#ef49548ea3d270097a67011921411130ceae7deb"
|
||||||
integrity sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==
|
integrity sha512-zND7NlS8rJYb/sPqkb13ZvbbUoExdbi4w3SfRrMq6R3FvnLQmmfpajJNITuuYm6AZ5uao9vy4BAos3EXBPf2rg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/unist" "^3.0.0"
|
"@types/unist" "^3.0.0"
|
||||||
unist-util-stringify-position "^4.0.0"
|
unist-util-stringify-position "^4.0.0"
|
||||||
vfile-message "^4.0.0"
|
vfile-message "^4.0.0"
|
||||||
|
|
||||||
|
web-streams-polyfill@^3.0.3:
|
||||||
|
version "3.3.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
|
||||||
|
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==
|
||||||
|
|
||||||
webidl-conversions@^3.0.0:
|
webidl-conversions@^3.0.0:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
||||||
@@ -1449,11 +1499,6 @@ whatwg-url@^5.0.0:
|
|||||||
tr46 "~0.0.3"
|
tr46 "~0.0.3"
|
||||||
webidl-conversions "^3.0.0"
|
webidl-conversions "^3.0.0"
|
||||||
|
|
||||||
yallist@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
|
||||||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
|
||||||
|
|
||||||
yaml-front-matter@^4.1.1:
|
yaml-front-matter@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/yaml-front-matter/-/yaml-front-matter-4.1.1.tgz#66eaa9a998fc3dd723708c73aa8e06e79cac91c9"
|
resolved "https://registry.yarnpkg.com/yaml-front-matter/-/yaml-front-matter-4.1.1.tgz#66eaa9a998fc3dd723708c73aa8e06e79cac91c9"
|
||||||
@@ -1463,9 +1508,9 @@ yaml-front-matter@^4.1.1:
|
|||||||
js-yaml "^3.14.1"
|
js-yaml "^3.14.1"
|
||||||
|
|
||||||
yaml@^2.3.4:
|
yaml@^2.3.4:
|
||||||
version "2.3.4"
|
version "2.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2"
|
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.0.tgz#c6165a721cf8000e91c36490a41d7be25176cf5d"
|
||||||
integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==
|
integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==
|
||||||
|
|
||||||
zwitch@^1.0.0:
|
zwitch@^1.0.0:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user