mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-25 22:41:36 +08:00
electron: Fix code block theme loading in dev mode
This commit is contained in:
parent
930b8e0ce2
commit
f5205fdd30
@ -9,6 +9,7 @@ import themeNames from "./code_block_theme_names.json" with { type: "json" }
|
|||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import utils from "./utils.js";
|
import utils from "./utils.js";
|
||||||
|
import env from "./env.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a color scheme for the code block syntax highlight.
|
* Represents a color scheme for the code block syntax highlight.
|
||||||
@ -30,8 +31,7 @@ interface ColorTheme {
|
|||||||
* @returns the supported themes, grouped.
|
* @returns the supported themes, grouped.
|
||||||
*/
|
*/
|
||||||
export function listSyntaxHighlightingThemes() {
|
export function listSyntaxHighlightingThemes() {
|
||||||
const stylesDir = (!utils.isElectron() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles");
|
const path = join(utils.getResourceDir(), getStylesDirectory());
|
||||||
const path = join(utils.getResourceDir(), stylesDir);
|
|
||||||
const systemThemes = readThemesFromFileSystem(path);
|
const systemThemes = readThemesFromFileSystem(path);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -45,6 +45,14 @@ export function listSyntaxHighlightingThemes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStylesDirectory() {
|
||||||
|
if (utils.isElectron() && !env.isDev()) {
|
||||||
|
return "styles";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "node_modules/@highlightjs/cdn-assets/styles";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads all the predefined themes by listing all minified CSSes from a given directory.
|
* Reads all the predefined themes by listing all minified CSSes from a given directory.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user