update notice

This commit is contained in:
2024-07-14 11:28:34 +01:00
parent be6f192dd8
commit 201f72ae0e
6 changed files with 23 additions and 17 deletions

View File

@@ -48,12 +48,12 @@ export const en = {
NotionCustomValues: "Customise values property", NotionCustomValues: "Customise values property",
NotionCustomValuesDesc: "Modify the column name of the Notion databaseone per line", NotionCustomValuesDesc: "Modify the column name of the Notion databaseone per line",
NotionCustomValuesText: "Enter all properties that you want to sync", NotionCustomValuesText: "Enter all properties that you want to sync",
NotYetFinish: NotYetFinish: "Not finished. This function will be available in the next version",
"Not finished. This function will be available in the next version",
PlaceHolder: "Enter database Name", PlaceHolder: "Enter database Name",
"notion-logo": "Share to NotionNext", "notion-logo": "Share to NotionNext",
"sync-success": "Sync to NotionNext success: \n", "sync-preffix": "Sync to ",
"sync-fail": "Sync to NotionNext fail: \n", "sync-success": "success",
"sync-fail": "failed",
"open-notion": "Please open the file that needs to be synchronized", "open-notion": "Please open the file that needs to be synchronized",
"config-secrets-notion-api": "config-secrets-notion-api":
"Please set up the notion API in the settings tab.", "Please set up the notion API in the settings tab.",
@@ -75,4 +75,5 @@ export const en = {
AddCustomProperty: "Add Custom Property", AddCustomProperty: "Add Custom Property",
AddNewProperty: "Add New Property", AddNewProperty: "Add New Property",
AddNewPropertyDesc: "Add new property match with your notion database", AddNewPropertyDesc: "Add new property match with your notion database",
CopyErrorMessage: "Auto copy failed, please copy it manually",
} }

View File

@@ -67,4 +67,5 @@ export const ja = {
AddCustomProperty: "カスタムプロパティを追加", AddCustomProperty: "カスタムプロパティを追加",
AddNewProperty: "新しいプロパティを追加", AddNewProperty: "新しいプロパティを追加",
AddNewPropertyDesc: "新しいプロパティを追加してください", AddNewPropertyDesc: "新しいプロパティを追加してください",
CopyErrorMessage: "自動コピーに失敗しました",
}; };

View File

@@ -70,4 +70,5 @@ export const zh = {
AddCustomProperty: "添加自定义属性", AddCustomProperty: "添加自定义属性",
AddNewProperty: "添加新属性", AddNewProperty: "添加新属性",
AddNewPropertyDesc: "添加一个和Notion数据库匹配的新属性", AddNewPropertyDesc: "添加一个和Notion数据库匹配的新属性",
CopyErrorMessage: "复制链接失败,请手动复制",
} }

View File

@@ -1,6 +1,7 @@
import { App, Notice, TFile } from "obsidian"; import { App, Notice, TFile } from "obsidian";
import ObsidianSyncNotionPlugin from "../main"; import ObsidianSyncNotionPlugin from "../main";
import { DatabaseDetails } from "../ui/settingTabs"; import { DatabaseDetails } from "../ui/settingTabs";
import { i18nConfig } from "src/lang/I18n";
export async function updateYamlInfo( export async function updateYamlInfo(
yamlContent: string, yamlContent: string,
@@ -37,6 +38,7 @@ export async function updateYamlInfo(
try { try {
await navigator.clipboard.writeText(url) await navigator.clipboard.writeText(url)
} catch (error) { } catch (error) {
new Notice(`复制链接失败,请手动复制${error}`) console.log(error)
new Notice(`${i18nConfig.CopyErrorMessage}`);
} }
} }

View File

@@ -54,9 +54,9 @@ export async function uploadCommandNext(
const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app); const res = await upload.syncMarkdownToNotionNext(basename, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime, markDownData, nowFile, this.app);
if (res.status === 200) { if (res.status === 200) {
new Notice(`${i18nConfig["sync-success"]}${basename}`); new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green";
} else { } else {
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000); new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000).noticeEl.style.color = "red";
} }
} }
@@ -88,7 +88,7 @@ export async function uploadCommandGeneral(
const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app); const res = await upload.syncMarkdownToNotionGeneral(basename, cover, tags, markDownData, nowFile, this.app);
if (res.status === 200) { if (res.status === 200) {
new Notice(`${i18nConfig["sync-success"]}${basename}`); new Notice(`${i18nConfig["sync-success"]}${basename}`).noticeEl.style.color = "green";
} else { } else {
new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000); new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000);
} }

View File

@@ -99,6 +99,7 @@ export class Upload2NotionCustom extends UploadBaseCustom {
app: App, app: App,
): Promise<any> { ): Promise<any> {
const options = { const options = {
strictImageUrls: true,
notionLimits: { notionLimits: {
truncate: false, truncate: false,
} }
@@ -123,7 +124,7 @@ export class Upload2NotionCustom extends UploadBaseCustom {
} else { } else {
res = await this.createPage(cover, customValues, file2Block); res = await this.createPage(cover, customValues, file2Block);
} }
if (res.status === 200) { if (res && res.status === 200) {
await updateYamlInfo(markdown, nowFile, res, app, this.plugin, this.dbDetails); await updateYamlInfo(markdown, nowFile, res, app, this.plugin, this.dbDetails);
} else { } else {
new Notice(`${res.text}`); new Notice(`${res.text}`);
@@ -228,7 +229,7 @@ export class Upload2NotionCustom extends UploadBaseCustom {
} }
); );
console.log(properties) // console.log(properties)
return { return {
parent: { parent: {