Fixed error: when switch tags is null

This commit is contained in:
chris
2022-12-19 21:07:26 +08:00
parent 41ebff9067
commit b6d5ff0093

View File

@@ -9,8 +9,6 @@ import {
Setting, Setting,
normalizePath normalizePath
} from "obsidian"; } from "obsidian";
import { join } from "path";
import * as fs from "fs";
import {addIcons} from 'icon'; import {addIcons} from 'icon';
import { Upload2Notion } from "Upload2Notion"; import { Upload2Notion } from "Upload2Notion";
import {NoticeMConfig} from "Message"; import {NoticeMConfig} from "Message";
@@ -99,8 +97,11 @@ export default class ObsidianSyncNotionPlugin extends Plugin {
async getNowFileMarkdownContent(app: App) { async getNowFileMarkdownContent(app: App) {
const nowFile = app.workspace.getActiveFile(); const nowFile = app.workspace.getActiveFile();
const tags = app.metadataCache.getFileCache(nowFile).frontmatter.tags; const { allowTags } = this.settings;
let tags = []
if (app.metadataCache.getFileCache(nowFile).tags !== undefined && allowTags) {
tags = app.metadataCache.getFileCache(nowFile).frontmatter.tags;
}
if (nowFile) { if (nowFile) {
const markDownData = await nowFile.vault.read(nowFile); const markDownData = await nowFile.vault.read(nowFile);
return { return {