mirror of
https://example.com
synced 2024-11-22 12:26:38 +09:00
feat: use syntax highlight assets on server
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
ae8209a848
commit
8c0a8c86ad
3 changed files with 4 additions and 6 deletions
|
@ -43,7 +43,6 @@
|
|||
### 細かい変更点
|
||||
|
||||
- コードブロックの構文ハイライトの対応言語を強化
|
||||
- TODO: CDN を利用しない設定でもこれを行えるようにする
|
||||
- TODO: 本家版にもマージリクエストを出す
|
||||
- モバイル表示の下部のウィジェットボタンを再読み込みボタンに変更可能に
|
||||
- スマートフォンでウィジェットは使わないけど再読み込みはたくさんする人はいそう
|
||||
|
|
1
packages/client/assets/prismjs/components
Symbolic link
1
packages/client/assets/prismjs/components
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../node_modules/prismjs/components
|
|
@ -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<string>();
|
||||
export const loadLanguage = (lang: string) =>
|
||||
new Promise<void>((resolve, reject) => {
|
||||
// for now
|
||||
if (!defaultStore.state.useEmojiCdn) return reject();
|
||||
// cached non-existing language
|
||||
if (nonExistingLanguagesCache.has(lang)) return reject();
|
||||
// load language with autoloader
|
||||
|
|
Loading…
Reference in a new issue