mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
fix(server): code block themes not listed again
This commit is contained in:
parent
ea03381801
commit
73f69f91f2
@ -1,11 +1,12 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { getStylesDirectory, readThemesFromFileSystem } from "./code_block_theme.js";
|
import { readThemesFromFileSystem } from "./code_block_theme.js";
|
||||||
|
|
||||||
import themeNames from "./code_block_theme_names.json" with { type: "json" };
|
import themeNames from "./code_block_theme_names.json" with { type: "json" };
|
||||||
|
import path = require("path");
|
||||||
|
|
||||||
describe("Code block theme", () => {
|
describe("Code block theme", () => {
|
||||||
it("all themes are mapped", () => {
|
it("all themes are mapped", () => {
|
||||||
const themes = readThemesFromFileSystem(getStylesDirectory());
|
const themes = readThemesFromFileSystem(path.join(__dirname, "../../node_modules/@highlightjs/cdn-assets/styles"));
|
||||||
|
|
||||||
const mappedThemeNames = new Set(Object.values(themeNames));
|
const mappedThemeNames = new Set(Object.values(themeNames));
|
||||||
const unmappedThemeNames = new Set<string>();
|
const unmappedThemeNames = new Set<string>();
|
||||||
|
@ -30,7 +30,7 @@ interface ColorTheme {
|
|||||||
* @returns the supported themes, grouped.
|
* @returns the supported themes, grouped.
|
||||||
*/
|
*/
|
||||||
export function listSyntaxHighlightingThemes() {
|
export function listSyntaxHighlightingThemes() {
|
||||||
const path = join(getResourceDir(), getStylesDirectory());
|
const path = getStylesDirectory();
|
||||||
const systemThemes = readThemesFromFileSystem(path);
|
const systemThemes = readThemesFromFileSystem(path);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -46,11 +46,11 @@ export function listSyntaxHighlightingThemes() {
|
|||||||
|
|
||||||
export function getStylesDirectory() {
|
export function getStylesDirectory() {
|
||||||
if (isElectron && !isDev) {
|
if (isElectron && !isDev) {
|
||||||
return "styles";
|
return join(getResourceDir(), "styles");
|
||||||
} else if (!isDev) {
|
} else if (!isDev) {
|
||||||
return "node_modules/@highlightjs/cdn-assets/styles";
|
return join(getResourceDir(), "node_modules/@highlightjs/cdn-assets/styles");
|
||||||
} else {
|
} else {
|
||||||
return join(__dirname, "../../node_modules/@highlightjs/cdn-assets/styles");
|
return join(__dirname, "../node_modules/@highlightjs/cdn-assets/styles");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user