Added auto copy share link to clipboard

This commit is contained in:
chris
2022-05-25 15:14:31 +08:00
parent 021584dac6
commit 6d5ece76b6
3 changed files with 12 additions and 11 deletions

View File

@@ -11,6 +11,16 @@ Share obsidian files to Notion with one click, and auto add Notion share link in
![](./doc/1.gif) ![](./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 # How to use
## Install the plugin ## Install the plugin
### BRAT ### BRAT
@@ -62,14 +72,7 @@ A share link will be automatically generated after successful upload
![](./doc/5.png) ![](./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. # Buy me a cup of coffee.

View File

@@ -93,7 +93,7 @@ export class Upload2Notion {
} }
console.log(res,'===') console.log(res,'===')
if (res.status === 200) { if (res.status === 200) {
this.updateYamlInfo(markdown, fullPath, res) await this.updateYamlInfo(markdown, fullPath, res)
} }
return res return res
} }
@@ -102,6 +102,7 @@ export class Upload2Notion {
const yamlObj:any = yamlFrontMatter.loadFront(yamlContent); const yamlObj:any = yamlFrontMatter.loadFront(yamlContent);
const {url, id} = res.json const {url, id} = res.json
yamlObj.link = url; yamlObj.link = url;
await navigator.clipboard.writeText(url)
yamlObj.notionID = id; yamlObj.notionID = id;
const __content = yamlObj.__content; const __content = yamlObj.__content;
delete yamlObj.__content delete yamlObj.__content

View File

@@ -45,9 +45,6 @@ export default class MyPlugin extends Plugin {
"Share to notion", "Share to notion",
async (evt: MouseEvent) => { async (evt: MouseEvent) => {
// Called when the user clicks the icon. // Called when the user clicks the icon.
this.upload(); this.upload();
} }
); );