Added custom banner url

This commit is contained in:
chris
2022-05-24 18:00:44 +08:00
parent c9a5c72c6c
commit 27c8e0f610
3 changed files with 28 additions and 0 deletions

View File

@@ -62,6 +62,12 @@ 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
# Buy me a cup of coffee. # Buy me a cup of coffee.
[Buy me a coffee](https://dun.mianbaoduo.com/@easy) [Buy me a coffee](https://dun.mianbaoduo.com/@easy)

View File

@@ -18,6 +18,12 @@ export class Upload2Notion {
parent: { parent: {
database_id: this.app.settings.databaseID database_id: this.app.settings.databaseID
}, },
cover: {
type: "external",
external: {
url: this.app.settings.bannerUrl
}
},
properties: { properties: {
Name: { Name: {
title: [ title: [

16
main.ts
View File

@@ -22,12 +22,14 @@ import { Upload2Notion } from "Upload2Notion";
interface MyPluginSettings { interface MyPluginSettings {
notionAPI: string; notionAPI: string;
databaseID: string; databaseID: string;
bannerUrl: string;
proxy: string; proxy: string;
} }
const DEFAULT_SETTINGS: MyPluginSettings = { const DEFAULT_SETTINGS: MyPluginSettings = {
notionAPI: "", notionAPI: "",
databaseID: "", databaseID: "",
bannerUrl: "",
proxy: "", proxy: "",
}; };
@@ -186,5 +188,19 @@ class SampleSettingTab extends PluginSettingTab {
}) })
); );
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();
})
);
} }
} }