mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 01:36:24 +01:00
chore(code): integrate JavaScript extension
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
"@codemirror/commands": "6.8.1",
|
||||
"@codemirror/lang-css": "6.3.1",
|
||||
"@codemirror/lang-html": "6.4.9",
|
||||
"@codemirror/lang-javascript": "6.2.3",
|
||||
"@codemirror/lang-markdown": "6.3.2",
|
||||
"@codemirror/lang-php": "6.0.1",
|
||||
"@codemirror/lang-vue": "0.1.3",
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import { LanguageSupport, type StreamParser } from "@codemirror/language"
|
||||
|
||||
async function buildJavaScript() {
|
||||
const { javascript } = await import('@codemirror/lang-javascript');
|
||||
return javascript();
|
||||
}
|
||||
|
||||
const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | LanguageSupport>) | null> = {
|
||||
"text/plain": null,
|
||||
|
||||
"application/dart": async () => (await import('@codemirror/legacy-modes/mode/clike')).dart,
|
||||
"application/edn": async () => (await import('@codemirror/legacy-modes/mode/clojure')).clojure,
|
||||
"application/javascript;env=backend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
|
||||
"application/javascript;env=frontend": async () => (await import('@codemirror/legacy-modes/mode/javascript')).javascript,
|
||||
"application/javascript;env=backend": buildJavaScript,
|
||||
"application/javascript;env=frontend": buildJavaScript,
|
||||
"application/json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).json,
|
||||
"application/ld+json": async () => (await import('@codemirror/legacy-modes/mode/javascript')).jsonld,
|
||||
"application/mbox": async () => (await import('@codemirror/legacy-modes/mode/mbox')).mbox,
|
||||
|
||||
Reference in New Issue
Block a user