mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-30 20:41:33 +08:00 
			
		
		
		
	chore(server): serve ck-content for share
This commit is contained in:
		
							parent
							
								
									8a23c3987e
								
							
						
					
					
						commit
						9cb56a4875
					
				| @ -5,6 +5,7 @@ import express from "express"; | ||||
| import { getResourceDir, isDev } from "../services/utils.js"; | ||||
| import type serveStatic from "serve-static"; | ||||
| import proxy from "express-http-proxy"; | ||||
| import contentCss from "@triliumnext/ckeditor5/content.css"; | ||||
| 
 | ||||
| const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<unknown, Record<string, unknown>>>) => { | ||||
|     if (!isDev) { | ||||
| @ -20,6 +21,8 @@ async function register(app: express.Application) { | ||||
|     const srcRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), ".."); | ||||
|     const resourceDir = getResourceDir(); | ||||
| 
 | ||||
|     app.use(`/${assetPath}/libraries/ckeditor/ckeditor-content.css`, (req, res) => res.contentType("text/css").send(contentCss)); | ||||
| 
 | ||||
|     if (isDev) { | ||||
|         const publicUrl = process.env.TRILIUM_PUBLIC_SERVER; | ||||
|         if (!publicUrl) { | ||||
|  | ||||
							
								
								
									
										5
									
								
								apps/server/src/types.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								apps/server/src/types.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -22,3 +22,8 @@ declare module "is-animated" { | ||||
|     function isAnimated(buffer: Buffer): boolean; | ||||
|     export default isAnimated; | ||||
| } | ||||
| 
 | ||||
| declare module "@triliumnext/ckeditor5/content.css" { | ||||
|     const content: string; | ||||
|     export default content; | ||||
| } | ||||
|  | ||||
| @ -33,6 +33,9 @@ | ||||
|     "src/**/*.spec.jsx" | ||||
|   ], | ||||
|   "references": [ | ||||
|     { | ||||
|       "path": "../../packages/ckeditor5/tsconfig.lib.json" | ||||
|     }, | ||||
|     { | ||||
|       "path": "../../packages/turndown-plugin-gfm/tsconfig.lib.json" | ||||
|     }, | ||||
|  | ||||
| @ -3,6 +3,9 @@ | ||||
|   "files": [], | ||||
|   "include": [], | ||||
|   "references": [ | ||||
|     { | ||||
|       "path": "../../packages/ckeditor5" | ||||
|     }, | ||||
|     { | ||||
|       "path": "../../packages/turndown-plugin-gfm" | ||||
|     }, | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); | ||||
| const CopyPlugin = require('copy-webpack-plugin'); | ||||
| const { join, default: path } = require('path'); | ||||
| const { join } = require('path'); | ||||
| 
 | ||||
| const outputDir = join(__dirname, 'dist'); | ||||
| 
 | ||||
| @ -48,6 +48,14 @@ module.exports = { | ||||
|   output: { | ||||
|     path: outputDir | ||||
|   }, | ||||
|   module: { | ||||
|     rules: [ | ||||
|       { | ||||
|         test: /\.css$/i, | ||||
|         type: "asset/source" | ||||
|       } | ||||
|     ] | ||||
|   }, | ||||
|   plugins: [ | ||||
|     new NxAppWebpackPlugin({ | ||||
|       target: 'node', | ||||
|  | ||||
| @ -10,6 +10,7 @@ | ||||
|   "exports": { | ||||
|     "./package.json": "./package.json", | ||||
|     "./emoji_definitions/": "./src/emoji_definitions/", | ||||
|     "./content.css": "./dist/content.css", | ||||
|     ".": { | ||||
|       "development": "./src/index.ts", | ||||
|       "types": "./dist/index.d.ts", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran