server: Fix loading of code block theme on server builds

This commit is contained in:
Elian Doran 2024-11-05 02:58:21 +02:00
parent a6385557b5
commit a02146df17
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -8,8 +8,7 @@ import fs from "fs";
import themeNames from "./code_block_theme_names.json" with { type: "json" } 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 { getResourceDir } 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.
@ -31,8 +30,8 @@ interface ColorTheme {
* @returns the supported themes, grouped. * @returns the supported themes, grouped.
*/ */
export function listSyntaxHighlightingThemes() { export function listSyntaxHighlightingThemes() {
const stylesDir = (env.isDev() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles"); const stylesDir = (!utils.isElectron() ? "node_modules/@highlightjs/cdn-assets/styles" : "styles");
const path = join(getResourceDir(), stylesDir); const path = join(utils.getResourceDir(), stylesDir);
const systemThemes = readThemesFromFileSystem(path); const systemThemes = readThemesFromFileSystem(path);
return { return {

View File

@ -364,5 +364,6 @@ export default {
normalize, normalize,
hashedBlobId, hashedBlobId,
toMap, toMap,
isString isString,
getResourceDir
}; };