mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
add custom frontmatter
This commit is contained in:
@@ -2,10 +2,12 @@ import { i18nConfig } from "../lang/I18n";
|
||||
import { App, Notice } from "obsidian";
|
||||
import { Upload2NotionNext } from "./upload_next/Upload2NotionNext";
|
||||
import { Upload2NotionGeneral } from "./upload_general/Upload2NotionGeneral";
|
||||
import { Upload2NotionCustom } from "./upoload_custom/Upload2NotionCustom";
|
||||
import { PluginSettings } from "../ui/settingTabs";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import { getNowFileMarkdownContentNext } from "./upload_next/getMarkdownNext";
|
||||
import { getNowFileMarkdownContentGeneral } from "./upload_general/getMarkdownGeneral";
|
||||
import {getNowFileMarkdownContentCustom} from "./upoload_custom/getMarkdownCustom";
|
||||
|
||||
export async function uploadCommandNext(
|
||||
plugin: ObsidianSyncNotionPlugin,
|
||||
@@ -78,3 +80,36 @@ export async function uploadCommandGeneral(
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function uploadCommandCustom(
|
||||
plugin: ObsidianSyncNotionPlugin,
|
||||
settings: PluginSettings,
|
||||
app: App,
|
||||
) {
|
||||
|
||||
const { notionAPIGeneral, databaseIDGeneral } = settings;
|
||||
|
||||
// Check if the user has set up the Notion API and database ID
|
||||
if (notionAPIGeneral === "" || databaseIDGeneral === "") {
|
||||
const setAPIMessage = i18nConfig["set-api-id"];
|
||||
new Notice(setAPIMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
const { markDownData, nowFile, cover, tags ,customValues} = await getNowFileMarkdownContentCustom(app, settings)
|
||||
|
||||
if (markDownData) {
|
||||
const { basename } = nowFile;
|
||||
|
||||
const upload = new Upload2NotionCustom(plugin);
|
||||
const res = await upload.syncMarkdownToNotionCustom(basename, cover, tags, customValues, markDownData, nowFile, this.app);
|
||||
|
||||
if (res.status === 200) {
|
||||
new Notice(`${i18nConfig["sync-success"]}${basename}`);
|
||||
} else {
|
||||
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user