mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	fix(canvas): proxying of fonts
This commit is contained in:
		| @@ -132,7 +132,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
|  | ||||
|         // currently required by excalidraw, in order to allows self-hosting fonts locally. | ||||
|         // this avoids making excalidraw load the fonts from an external CDN. | ||||
|         (window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/${asset_path}/app-dist/excalidraw/`; | ||||
|         (window as any).EXCALIDRAW_ASSET_PATH = `${new URL(import.meta.url).origin}/node_modules/@excalidraw/excalidraw/dist/prod`; | ||||
|  | ||||
|         // temporary vars | ||||
|         this.currentNoteId = ""; | ||||
|   | ||||
| @@ -22,6 +22,15 @@ export default defineConfig(() => ({ | ||||
|                 src: `src/${asset}/**/*`, | ||||
|                 dest: asset | ||||
|             })) | ||||
|         }), | ||||
|         viteStaticCopy({ | ||||
|             structured: true, | ||||
|             targets: [ | ||||
|                 { | ||||
|                     src: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/*", | ||||
|                     dest: "", | ||||
|                 } | ||||
|             ] | ||||
|         }) | ||||
|     ], | ||||
|     // Uncomment this if you are using workers. | ||||
|   | ||||
| @@ -10,7 +10,6 @@ | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@electron/remote": "2.1.2", | ||||
|     "@excalidraw/excalidraw": "0.18.0", | ||||
|     "@types/archiver": "6.0.3", | ||||
|     "@types/better-sqlite3": "7.6.13", | ||||
|     "@types/cls-hooked": "4.3.9", | ||||
|   | ||||
| @@ -38,7 +38,6 @@ async function register(app: express.Application) { | ||||
|         app.use(`/${assetPath}/translations/`, persistentCacheStatic(path.join(resourceDir, "public", "translations"))); | ||||
|         app.use(`/${assetPath}/images`, persistentCacheStatic(path.join(resourceDir, "assets", "images"))); | ||||
|         app.use(`/${assetPath}/app-dist/doc_notes`, persistentCacheStatic(path.join(resourceDir, "assets", "doc_notes"))); | ||||
|         app.use(`/${assetPath}/app-dist/excalidraw/fonts`, persistentCacheStatic(path.join(resourceDir, "node_modules/@excalidraw/excalidraw/dist/prod/fonts"))); | ||||
|     } | ||||
|     app.use(`/assets/vX/fonts`, express.static(path.join(srcRoot, "public/fonts"))); | ||||
|     app.use(`/assets/vX/images`, express.static(path.join(srcRoot, "..", "images"))); | ||||
| @@ -48,9 +47,6 @@ async function register(app: express.Application) { | ||||
|  | ||||
|     const nodeModulesDir = isDev ? path.join(srcRoot, "..", "node_modules") : path.join(resourceDir, "node_modules"); | ||||
|  | ||||
|     app.use(`/node_modules/@excalidraw/excalidraw/dist/fonts/`, express.static(path.join(nodeModulesDir, "@excalidraw/excalidraw/dist/prod/fonts/"))); | ||||
|     app.use(`/${assetPath}/node_modules/@excalidraw/excalidraw/dist/fonts/`, persistentCacheStatic(path.join(nodeModulesDir, "@excalidraw/excalidraw/dist/prod/fonts/"))); | ||||
|  | ||||
|     app.use(`/${assetPath}/node_modules/jquery/dist/`, persistentCacheStatic(path.join(nodeModulesDir, "jquery/dist/"))); | ||||
|  | ||||
|     app.use(`/${assetPath}/node_modules/jquery-hotkeys/`, persistentCacheStatic(path.join(nodeModulesDir, "jquery-hotkeys/"))); | ||||
|   | ||||
| @@ -13,7 +13,6 @@ function buildFilesToCopy() { | ||||
|   }); | ||||
|  | ||||
|   const nodePaths = [ | ||||
|     "@excalidraw/excalidraw/dist/prod/fonts/", | ||||
|     "jquery/dist", | ||||
|     "jquery-hotkeys", | ||||
|     "jquery.fancytree/dist", | ||||
|   | ||||
							
								
								
									
										3
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							| @@ -500,9 +500,6 @@ importers: | ||||
|       '@electron/remote': | ||||
|         specifier: 2.1.2 | ||||
|         version: 2.1.2(electron@36.2.1) | ||||
|       '@excalidraw/excalidraw': | ||||
|         specifier: 0.18.0 | ||||
|         version: 0.18.0(@types/react-dom@19.1.5(@types/react@19.1.4))(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) | ||||
|       '@triliumnext/commons': | ||||
|         specifier: workspace:* | ||||
|         version: link:../../packages/commons | ||||
|   | ||||
		Reference in New Issue
	
	Block a user