diff --git a/docs/changes.md b/docs/changes.md index 9c58f8a8..890b032e 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -43,7 +43,6 @@ ### 細かい変更点 - コードブロックの構文ハイライトの対応言語を強化 - - TODO: CDN を利用しない設定でもこれを行えるようにする - TODO: 本家版にもマージリクエストを出す - モバイル表示の下部のウィジェットボタンを再読み込みボタンに変更可能に - スマートフォンでウィジェットは使わないけど再読み込みはたくさんする人はいそう diff --git a/packages/client/assets/prismjs/components b/packages/client/assets/prismjs/components new file mode 120000 index 00000000..e54cd377 --- /dev/null +++ b/packages/client/assets/prismjs/components @@ -0,0 +1 @@ +../../node_modules/prismjs/components \ No newline at end of file diff --git a/packages/client/src/scripts/prism.ts b/packages/client/src/scripts/prism.ts index 0b102359..ad1a5ea0 100644 --- a/packages/client/src/scripts/prism.ts +++ b/packages/client/src/scripts/prism.ts @@ -2,15 +2,13 @@ import Prism from "prismjs"; import "prismjs/plugins/autoloader/prism-autoloader.js"; import { defaultStore } from "@/store"; -// TODO -Prism.plugins.autoloader.languages_path = - "https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/"; +Prism.plugins.autoloader.languages_path = defaultStore.state.useEmojiCdn + ? "https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/" + : "/client-assets/prismjs/components/"; const nonExistingLanguagesCache = new Set(); export const loadLanguage = (lang: string) => new Promise((resolve, reject) => { - // for now - if (!defaultStore.state.useEmojiCdn) return reject(); // cached non-existing language if (nonExistingLanguagesCache.has(lang)) return reject(); // load language with autoloader