From 6d5ece76b6b7f58e58011dc9560f68d00b3ceacd Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 25 May 2022 15:14:31 +0800 Subject: [PATCH] Added auto copy share link to clipboard --- README.md | 17 ++++++++++------- Upload2Notion.ts | 3 ++- main.ts | 3 --- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9354391..3ef70bb 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,16 @@ Share obsidian files to Notion with one click, and auto add Notion share link in ![](./doc/1.gif) +# Todo + +- [x] support for custom page banner +- [x] update the exsit page +- [x] support for mult language +- [x] support for auto copy the share link to clipboard +- [ ] support for mobile +- [ ] transfer the bi-link format like [[]] into the format that Notion supports. + + # How to use ## Install the plugin ### BRAT @@ -62,14 +72,7 @@ A share link will be automatically generated after successful upload ![](./doc/5.png) -# Todo -- [ ] support for mobile -- [x] support for custom page banner -- [ ] update the exsit page -- [ ] transfer the bi-link format like [[]] into the format that Notion supports. -- [ ] support for mult language -- [ ] support for auto copy the share link to clipboard # Buy me a cup of coffee. diff --git a/Upload2Notion.ts b/Upload2Notion.ts index da94fad..d3b2214 100644 --- a/Upload2Notion.ts +++ b/Upload2Notion.ts @@ -93,7 +93,7 @@ export class Upload2Notion { } console.log(res,'===') if (res.status === 200) { - this.updateYamlInfo(markdown, fullPath, res) + await this.updateYamlInfo(markdown, fullPath, res) } return res } @@ -102,6 +102,7 @@ export class Upload2Notion { const yamlObj:any = yamlFrontMatter.loadFront(yamlContent); const {url, id} = res.json yamlObj.link = url; + await navigator.clipboard.writeText(url) yamlObj.notionID = id; const __content = yamlObj.__content; delete yamlObj.__content diff --git a/main.ts b/main.ts index 255638d..d00cacf 100644 --- a/main.ts +++ b/main.ts @@ -45,9 +45,6 @@ export default class MyPlugin extends Plugin { "Share to notion", async (evt: MouseEvent) => { // Called when the user clicks the icon. - - - this.upload(); } );