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