mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +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 { 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 path = require("path"); | ||||
| 
 | ||||
| describe("Code block theme", () => { | ||||
|     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 unmappedThemeNames = new Set<string>(); | ||||
|  | ||||
| @ -30,7 +30,7 @@ interface ColorTheme { | ||||
|  * @returns the supported themes, grouped. | ||||
|  */ | ||||
| export function listSyntaxHighlightingThemes() { | ||||
|     const path = join(getResourceDir(), getStylesDirectory()); | ||||
|     const path = getStylesDirectory(); | ||||
|     const systemThemes = readThemesFromFileSystem(path); | ||||
| 
 | ||||
|     return { | ||||
| @ -46,11 +46,11 @@ export function listSyntaxHighlightingThemes() { | ||||
| 
 | ||||
| export function getStylesDirectory() { | ||||
|     if (isElectron && !isDev) { | ||||
|         return "styles"; | ||||
|         return join(getResourceDir(), "styles"); | ||||
|     } else if (!isDev) { | ||||
|         return "node_modules/@highlightjs/cdn-assets/styles"; | ||||
|         return join(getResourceDir(), "node_modules/@highlightjs/cdn-assets/styles"); | ||||
|     } 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
	 Elian Doran
						Elian Doran