From 201f72ae0ee024494edcf8b6da9d5cb210ce40d4 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Sun, 14 Jul 2024 11:28:34 +0100 Subject: [PATCH] update notice --- src/lang/locale/en.ts | 23 ++++++++++--------- src/lang/locale/ja.ts | 1 + src/lang/locale/zh.ts | 1 + src/upload/updateYaml.ts | 4 +++- src/upload/uploadCommand.ts | 6 ++--- .../upoload_custom/Upload2NotionCustom.ts | 5 ++-- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index cbba596..2a7250a 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -27,11 +27,11 @@ export const en = { DatabaseIDText: "Enter your Database ID", BannerUrl: "Banner url (optional)", BannerUrlDesc: -"Default is empty, if you want to show a banner, please enter the url (like: https://abc.com/b.png)", + "Default is empty, if you want to show a banner, please enter the url (like: https://abc.com/b.png)", BannerUrlText: "Enter your banner url", NotionUser: "Notion ID (username, optional)", NotionUserDesc: -"Collect from share link likes:https://username.notion.site. Your notion id is [username]", + "Collect from share link likes:https://username.notion.site. Your notion id is [username]", NotionUserText: "Enter your notion ID", NotionLinkDisplay: "Notion Link Display", NotionLinkDisplayDesc: "Default is ON, if you want to hide the link in the front matter, please turn it off", @@ -48,23 +48,23 @@ export const en = { NotionCustomValues: "Customise values property", NotionCustomValuesDesc: "Modify the column name of the Notion database,one per line", NotionCustomValuesText: "Enter all properties that you want to sync", - NotYetFinish: -"Not finished. This function will be available in the next version", + NotYetFinish: "Not finished. This function will be available in the next version", PlaceHolder: "Enter database Name", "notion-logo": "Share to NotionNext", - "sync-success": "Sync to NotionNext success: \n", - "sync-fail": "Sync to NotionNext fail: \n", + "sync-preffix": "Sync to ", + "sync-success": "success", + "sync-fail": "failed", "open-notion": "Please open the file that needs to be synchronized", "config-secrets-notion-api": -"Please set up the notion API in the settings tab.", + "Please set up the notion API in the settings tab.", "config-secrets-database-id": -"Please set up the database id in the settings tab.", + "Please set up the database id in the settings tab.", "set-tags-fail": -"Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.", + "Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.", NNonMissing: -"The 'NNon' property is missing in the settings. Please set it up.", + "The 'NNon' property is missing in the settings. Please set it up.", "set-api-id": -"Please set up the notion API and database ID in the settings tab.", + "Please set up the notion API and database ID in the settings tab.", NotionCustomSettingHeader: "Notion Custom Database Settings", NotionCustomButton: "Notion Customised command switch", NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette", @@ -75,4 +75,5 @@ export const en = { AddCustomProperty: "Add Custom Property", AddNewProperty: "Add New Property", AddNewPropertyDesc: "Add new property match with your notion database", + CopyErrorMessage: "Auto copy failed, please copy it manually", } diff --git a/src/lang/locale/ja.ts b/src/lang/locale/ja.ts index 0221025..25f10f2 100644 --- a/src/lang/locale/ja.ts +++ b/src/lang/locale/ja.ts @@ -67,4 +67,5 @@ export const ja = { AddCustomProperty: "カスタムプロパティを追加", AddNewProperty: "新しいプロパティを追加", AddNewPropertyDesc: "新しいプロパティを追加してください", + CopyErrorMessage: "自動コピーに失敗しました", }; diff --git a/src/lang/locale/zh.ts b/src/lang/locale/zh.ts index 08a9375..0ae609f 100644 --- a/src/lang/locale/zh.ts +++ b/src/lang/locale/zh.ts @@ -70,4 +70,5 @@ export const zh = { AddCustomProperty: "添加自定义属性", AddNewProperty: "添加新属性", AddNewPropertyDesc: "添加一个和Notion数据库匹配的新属性", + CopyErrorMessage: "复制链接失败,请手动复制", } diff --git a/src/upload/updateYaml.ts b/src/upload/updateYaml.ts index d479015..9772adb 100644 --- a/src/upload/updateYaml.ts +++ b/src/upload/updateYaml.ts @@ -1,6 +1,7 @@ import { App, Notice, TFile } from "obsidian"; import ObsidianSyncNotionPlugin from "../main"; import { DatabaseDetails } from "../ui/settingTabs"; +import { i18nConfig } from "src/lang/I18n"; export async function updateYamlInfo( yamlContent: string, @@ -37,6 +38,7 @@ export async function updateYamlInfo( try { await navigator.clipboard.writeText(url) } catch (error) { - new Notice(`复制链接失败,请手动复制${error}`) + console.log(error) + new Notice(`${i18nConfig.CopyErrorMessage}`); } } diff --git a/src/upload/uploadCommand.ts b/src/upload/uploadCommand.ts index 9f9bc3b..1194b96 100644 --- a/src/upload/uploadCommand.ts +++ b/src/upload/uploadCommand.ts @@ -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); if (res.status === 200) { - new Notice(`${i18nConfig["sync-success"]}${basename}`); + new Notice(`${i18nConfig["sync-preffix"]} ${basename} ${i18nConfig["sync-success"]}`).noticeEl.style.color = "green"; } 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); if (res.status === 200) { - new Notice(`${i18nConfig["sync-success"]}${basename}`); + new Notice(`${i18nConfig["sync-success"]}${basename}`).noticeEl.style.color = "green"; } else { new Notice(`${i18nConfig["sync-fail"]}${basename}`, 5000); } diff --git a/src/upload/upoload_custom/Upload2NotionCustom.ts b/src/upload/upoload_custom/Upload2NotionCustom.ts index da03bf9..9cdd115 100644 --- a/src/upload/upoload_custom/Upload2NotionCustom.ts +++ b/src/upload/upoload_custom/Upload2NotionCustom.ts @@ -99,6 +99,7 @@ export class Upload2NotionCustom extends UploadBaseCustom { app: App, ): Promise { const options = { + strictImageUrls: true, notionLimits: { truncate: false, } @@ -123,7 +124,7 @@ export class Upload2NotionCustom extends UploadBaseCustom { } else { 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); } else { new Notice(`${res.text}`); @@ -228,7 +229,7 @@ export class Upload2NotionCustom extends UploadBaseCustom { } ); - console.log(properties) + // console.log(properties) return { parent: {