mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
complete the basic customisation feature
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {App, Notice, TFile} from "obsidian";
|
||||
import { App, Notice, TFile } from "obsidian";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {PluginSettings} from "../ui/settingTabs";
|
||||
import { PluginSettings } from "../ui/settingTabs";
|
||||
|
||||
export async function updateYamlInfo(
|
||||
yamlContent: string,
|
||||
@@ -9,7 +9,7 @@ export async function updateYamlInfo(
|
||||
app: App,
|
||||
plugin: ObsidianSyncNotionPlugin,
|
||||
) {
|
||||
let {url, id} = res.json
|
||||
let { url, id } = res.json
|
||||
// replace www to notionID
|
||||
const { notionUser } = plugin.settings;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {i18nConfig} from "../lang/I18n";
|
||||
import {App, Notice} from "obsidian";
|
||||
import {Upload2NotionNext} from "./upload_next/Upload2NotionNext";
|
||||
import {Upload2NotionGeneral} from "./upload_general/Upload2NotionGeneral";
|
||||
import {PluginSettings} from "../ui/settingTabs";
|
||||
import { i18nConfig } from "../lang/I18n";
|
||||
import { App, Notice } from "obsidian";
|
||||
import { Upload2NotionNext } from "./upload_next/Upload2NotionNext";
|
||||
import { Upload2NotionGeneral } from "./upload_general/Upload2NotionGeneral";
|
||||
import { PluginSettings } from "../ui/settingTabs";
|
||||
import ObsidianSyncNotionPlugin from "../main";
|
||||
import {getNowFileMarkdownContentNext} from "./upload_next/getMarkdownNext";
|
||||
import {getNowFileMarkdownContentGeneral} from "./upload_general/getMarkdownGeneral";
|
||||
import { getNowFileMarkdownContentNext } from "./upload_next/getMarkdownNext";
|
||||
import { getNowFileMarkdownContentGeneral } from "./upload_general/getMarkdownGeneral";
|
||||
|
||||
export async function uploadCommandNext(
|
||||
plugin: ObsidianSyncNotionPlugin,
|
||||
@@ -13,7 +13,7 @@ export async function uploadCommandNext(
|
||||
app: App,
|
||||
) {
|
||||
|
||||
const {notionAPINext, databaseIDNext} = settings;
|
||||
const { notionAPINext, databaseIDNext } = settings;
|
||||
|
||||
// Check if NNon exists
|
||||
// if (NNon === undefined) {
|
||||
@@ -29,10 +29,10 @@ export async function uploadCommandNext(
|
||||
return;
|
||||
}
|
||||
|
||||
const {markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime} = await getNowFileMarkdownContentNext(app, settings)
|
||||
const { markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime } = await getNowFileMarkdownContentNext(app, settings)
|
||||
|
||||
if (markDownData) {
|
||||
const {basename} = nowFile;
|
||||
const { basename } = nowFile;
|
||||
const upload = new Upload2NotionNext(plugin);
|
||||
const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app);
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function uploadCommandGeneral(
|
||||
app: App,
|
||||
) {
|
||||
|
||||
const{ notionAPIGeneral, databaseIDGeneral} = settings;
|
||||
const { notionAPIGeneral, databaseIDGeneral } = settings;
|
||||
|
||||
// Check if the user has set up the Notion API and database ID
|
||||
if (notionAPIGeneral === "" || databaseIDGeneral === "") {
|
||||
@@ -62,10 +62,10 @@ export async function uploadCommandGeneral(
|
||||
return;
|
||||
}
|
||||
|
||||
const {markDownData, nowFile,cover, tags} = await getNowFileMarkdownContentGeneral(app, settings)
|
||||
const { markDownData, nowFile, cover, tags } = await getNowFileMarkdownContentGeneral(app, settings)
|
||||
|
||||
if (markDownData) {
|
||||
const {basename} = nowFile;
|
||||
const { basename } = nowFile;
|
||||
|
||||
const upload = new Upload2NotionGeneral(plugin);
|
||||
const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app);
|
||||
|
||||
@@ -4,15 +4,15 @@ import { markdownToBlocks, } from "@tryfabric/martian";
|
||||
import * as yamlFrontMatter from "yaml-front-matter";
|
||||
// import * as yaml from "yaml"
|
||||
import MyPlugin from "src/main";
|
||||
import {PluginSettings} from "../../ui/settingTabs";
|
||||
import {UploadBaseGeneral} from "./BaseUpload2NotionGeneral";
|
||||
import {updateYamlInfo} from "../updateYaml";
|
||||
import { PluginSettings } from "../../ui/settingTabs";
|
||||
import { UploadBaseGeneral } from "./BaseUpload2NotionGeneral";
|
||||
import { updateYamlInfo } from "../updateYaml";
|
||||
|
||||
export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
settings: PluginSettings;
|
||||
|
||||
constructor(plugin: MyPlugin) {
|
||||
super(plugin);
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
// 因为需要解析notion的block进行对比,非常的麻烦,
|
||||
@@ -22,7 +22,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
title: string,
|
||||
cover: string,
|
||||
tags: string[],
|
||||
childArr: any
|
||||
childArr: any,
|
||||
) {
|
||||
await this.deletePage(notionID)
|
||||
|
||||
@@ -50,7 +50,7 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
database_id: this.plugin.settings.databaseIDGeneral,
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
[this.plugin.settings.CustomTitleButton ? this.plugin.settings.CustomTitleName : 'title']: {
|
||||
title: [
|
||||
{
|
||||
text: {
|
||||
|
||||
Reference in New Issue
Block a user