From 27c8e0f610ef677b4d5bd40e47690bd6a10bc396 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 24 May 2022 18:00:44 +0800 Subject: [PATCH] Added custom banner url --- README.md | 6 ++++++ Upload2Notion.ts | 6 ++++++ main.ts | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/README.md b/README.md index bc69949..6eb18ca 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,12 @@ 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 + # Buy me a cup of coffee. [Buy me a coffee](https://dun.mianbaoduo.com/@easy) diff --git a/Upload2Notion.ts b/Upload2Notion.ts index b4a5955..3049c37 100644 --- a/Upload2Notion.ts +++ b/Upload2Notion.ts @@ -18,6 +18,12 @@ export class Upload2Notion { parent: { database_id: this.app.settings.databaseID }, + cover: { + type: "external", + external: { + url: this.app.settings.bannerUrl + } + }, properties: { Name: { title: [ diff --git a/main.ts b/main.ts index 0c46f25..f1a48bd 100644 --- a/main.ts +++ b/main.ts @@ -22,12 +22,14 @@ import { Upload2Notion } from "Upload2Notion"; interface MyPluginSettings { notionAPI: string; databaseID: string; + bannerUrl: string; proxy: string; } const DEFAULT_SETTINGS: MyPluginSettings = { notionAPI: "", databaseID: "", + bannerUrl: "", proxy: "", }; @@ -185,6 +187,20 @@ class SampleSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); }) ); + + new Setting(containerEl) + .setName("Banner Url") + .setDesc("page banner url") + .addText((text) => + text + .setPlaceholder("Enter banner pic url: ") + .setValue(this.plugin.settings.bannerUrl) + .onChange(async (value) => { + console.log("Secret: " + value); + this.plugin.settings.bannerUrl = value; + await this.plugin.saveSettings(); + }) + ); } }