mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-30 17:18:36 +08:00
Compare commits
6 Commits
00411e9599
...
2.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1344c14933 | ||
|
|
c1f4ecd14b | ||
|
|
5942876c92 | ||
|
|
3218eb9fba | ||
|
|
48566eca20 | ||
|
|
8bd8346423 |
@@ -1,4 +1,4 @@
|
|||||||
## Fix
|
## Fix
|
||||||
|
|
||||||
- Fix code block not being highlighted in Notion after syncing.
|
- Fix a bug that the plugin cannot read the title from the markdown front matter if using custom database.
|
||||||
- 修复代码块同步之后,在 Notion 中未高亮的问题。
|
- 修复当使用自定义数据库时,插件无法从markdown front matter中读取标题的问题。
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "share-to-notionnext",
|
"id": "share-to-notionnext",
|
||||||
"name": "Share to NotionNext",
|
"name": "Share to NotionNext",
|
||||||
"version": "2.4.1",
|
"version": "2.4.3",
|
||||||
"minAppVersion": "0.0.1",
|
"minAppVersion": "0.0.1",
|
||||||
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
|
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
|
||||||
"author": "EasyChris, jxpeng98",
|
"author": "EasyChris, jxpeng98",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "share-to-notionnext",
|
"name": "share-to-notionnext",
|
||||||
"version": "2.4.1",
|
"version": "2.4.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Share files to any Notion database using the Notion API, originally created by EasyChris/obsidian-to-notion.",
|
"description": "Share files to any Notion database using the Notion API, originally created by EasyChris/obsidian-to-notion.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
|||||||
@@ -8,10 +8,42 @@ export const I18n: {[key: string]:any} = {
|
|||||||
ja,
|
ja,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const I18nConfig = (lang: string): any => {
|
class I18nManager {
|
||||||
return I18n[lang];
|
private currentLanguage: string;
|
||||||
};
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.currentLanguage = this.detectLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the language to use
|
||||||
|
private detectLanguage(): string {
|
||||||
const storedLanguage = window.localStorage.getItem("language");
|
const storedLanguage = window.localStorage.getItem("language");
|
||||||
|
if (storedLanguage && this.isLanguageSupported(storedLanguage)) {
|
||||||
|
console.log(`Using stored language: ${storedLanguage}`);
|
||||||
|
return storedLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
export const i18nConfig = I18n[storedLanguage || window.navigator.language.split('-')[0] || "en"];
|
const browserLanguage = window.navigator.language.split("-")[0];
|
||||||
|
if (this.isLanguageSupported(browserLanguage)) {
|
||||||
|
console.log(`Using browser language: ${browserLanguage}`);
|
||||||
|
return browserLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to English if no match is found
|
||||||
|
console.log("Using default language: en");
|
||||||
|
return "en";
|
||||||
|
}
|
||||||
|
|
||||||
|
private isLanguageSupported(lang: string): boolean {
|
||||||
|
return Object.prototype.hasOwnProperty.call(I18n, lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the i18n configuration for the current language
|
||||||
|
public getConfig(): any {
|
||||||
|
return I18n[this.currentLanguage];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const i18nManager = new I18nManager();
|
||||||
|
|
||||||
|
export const i18nConfig = i18nManager.getConfig();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default class ObsidianSyncNotionPlugin extends Plugin {
|
|||||||
|
|
||||||
addIcons();
|
addIcons();
|
||||||
// This creates an icon in the left ribbon.
|
// This creates an icon in the left ribbon.
|
||||||
const ribbonIconEl = this.addRibbonIcon(
|
this.addRibbonIcon(
|
||||||
"notion-logo",
|
"notion-logo",
|
||||||
i18nConfig.ribbonIcon,
|
i18nConfig.ribbonIcon,
|
||||||
async (evt: MouseEvent) => {
|
async (evt: MouseEvent) => {
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ export async function getNowFileMarkdownContentCustom(
|
|||||||
|
|
||||||
// If a 'title' type property exists, use the file's basename as its value
|
// If a 'title' type property exists, use the file's basename as its value
|
||||||
if (titleProperty) {
|
if (titleProperty) {
|
||||||
customValues[titleProperty.customName] = nowFile.basename; // Use 'basename' for the file name without extension
|
customValues[titleProperty.customName] =
|
||||||
|
(FileCache.frontmatter && FileCache.frontmatter[titleProperty.customName]) ?
|
||||||
|
FileCache.frontmatter[titleProperty.customName] : // use the front matter value if it exists
|
||||||
|
nowFile.basename; // Use 'basename' for the file name without extension
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
23
yarn.lock
23
yarn.lock
@@ -460,14 +460,6 @@ commander@^8.3.0:
|
|||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
||||||
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
||||||
|
|
||||||
cors@^2.8.5:
|
|
||||||
version "2.8.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
|
||||||
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
|
||||||
dependencies:
|
|
||||||
object-assign "^4"
|
|
||||||
vary "^1"
|
|
||||||
|
|
||||||
data-uri-to-buffer@^4.0.0:
|
data-uri-to-buffer@^4.0.0:
|
||||||
version "4.0.1"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
|
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
|
||||||
@@ -722,11 +714,6 @@ katex@^0.16.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
commander "^8.3.0"
|
commander "^8.3.0"
|
||||||
|
|
||||||
ky@^1.7.2:
|
|
||||||
version "1.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/ky/-/ky-1.7.2.tgz#b97d9b997ba51ff1e152f0815d3d27b86513eb1c"
|
|
||||||
integrity sha512-OzIvbHKKDpi60TnF9t7UUVAF1B4mcqc02z5PIvrm08Wyb+yOcz63GRvEuVxNT18a9E1SrNouhB4W2NNLeD7Ykg==
|
|
||||||
|
|
||||||
longest-streak@^2.0.0:
|
longest-streak@^2.0.0:
|
||||||
version "2.0.4"
|
version "2.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
|
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
|
||||||
@@ -1228,11 +1215,6 @@ node-fetch@^3.3.2:
|
|||||||
fetch-blob "^3.1.4"
|
fetch-blob "^3.1.4"
|
||||||
formdata-polyfill "^4.0.10"
|
formdata-polyfill "^4.0.10"
|
||||||
|
|
||||||
object-assign@^4:
|
|
||||||
version "4.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
|
||||||
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
|
|
||||||
|
|
||||||
obsidian@^1.6.6:
|
obsidian@^1.6.6:
|
||||||
version "1.6.6"
|
version "1.6.6"
|
||||||
resolved "https://registry.yarnpkg.com/obsidian/-/obsidian-1.6.6.tgz#d45c4021c291765e1b77ed4a1c645e562ff6e77f"
|
resolved "https://registry.yarnpkg.com/obsidian/-/obsidian-1.6.6.tgz#d45c4021c291765e1b77ed4a1c645e562ff6e77f"
|
||||||
@@ -1459,11 +1441,6 @@ unist-util-visit@^5.0.0:
|
|||||||
unist-util-is "^6.0.0"
|
unist-util-is "^6.0.0"
|
||||||
unist-util-visit-parents "^6.0.0"
|
unist-util-visit-parents "^6.0.0"
|
||||||
|
|
||||||
vary@^1:
|
|
||||||
version "1.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
|
||||||
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
|
|
||||||
|
|
||||||
vfile-message@^2.0.0:
|
vfile-message@^2.0.0:
|
||||||
version "2.0.4"
|
version "2.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a"
|
resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a"
|
||||||
|
|||||||
Reference in New Issue
Block a user