mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 19:19:03 +01:00 
			
		
		
		
	fix(nx/client): assets and inline SVG for CKEditor plugins
This commit is contained in:
		
							parent
							
								
									528704ef71
								
							
						
					
					
						commit
						444e33628c
					
				| @ -199,7 +199,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget implem | ||||
|     private $saveAttributesButton!: JQuery<HTMLElement>; | ||||
|     private $errors!: JQuery<HTMLElement>; | ||||
| 
 | ||||
|     private textEditor!: TextEditor; | ||||
|     private textEditor!: BalloonEditor; | ||||
|     private lastUpdatedNoteId!: string | undefined; | ||||
|     private lastSavedContent!: string; | ||||
| 
 | ||||
| @ -213,7 +213,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget implem | ||||
|         this.$widget = $(TPL); | ||||
|         this.$editor = this.$widget.find(".attribute-list-editor"); | ||||
| 
 | ||||
|         this.initialized = this.initEditor(); | ||||
|         // this.initialized = this.initEditor();
 | ||||
| 
 | ||||
|         this.$editor.on("keydown", async (e) => { | ||||
|             if (e.which === 13) { | ||||
| @ -373,7 +373,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget implem | ||||
| 
 | ||||
|         this.$editor.on("click", (e) => this.handleEditorClick(e)); | ||||
| 
 | ||||
|         this.textEditor = BalloonEditor.create(this.$editor[0], editorConfig); | ||||
|         this.textEditor = await BalloonEditor.create(this.$editor[0], editorConfig); | ||||
|         this.textEditor.model.document.on("change:data", () => this.dataChanged()); | ||||
|         this.textEditor.editing.view.document.on( | ||||
|             "enter", | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| 
 | ||||
| const { composePlugins, withNx, withWeb } = require('@nx/webpack'); | ||||
| const { join } = require('path'); | ||||
| const CopyPlugin = require('copy-webpack-plugin'); | ||||
| 
 | ||||
| module.exports = composePlugins( | ||||
|   withNx({ | ||||
| @ -38,13 +39,6 @@ module.exports = composePlugins( | ||||
|       "electron" | ||||
|     ], | ||||
|     baseHref: '/', | ||||
|     assets: [ | ||||
|       join(__dirname, "./src/assets"), | ||||
|       join(__dirname, "./src/stylesheets"), | ||||
|       join(__dirname, "./src/libraries"), | ||||
|       join(__dirname, "./src/fonts"), | ||||
|       join(__dirname, "./src/translations") | ||||
|     ], | ||||
|     outputHashing: false, | ||||
|     optimization: process.env['NODE_ENV'] === 'production' | ||||
|   }), | ||||
| @ -78,6 +72,32 @@ module.exports = composePlugins( | ||||
|       util: false | ||||
|     }; | ||||
| 
 | ||||
|     const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ]       | ||||
|     config.plugins.push(new CopyPlugin({ | ||||
|       patterns: assets.map((asset) => ({ | ||||
|         from: join(__dirname, "src", asset), | ||||
|         to: asset | ||||
|       })) | ||||
|     })); | ||||
| 
 | ||||
|     inlineSvg(config); | ||||
| 
 | ||||
|     return config; | ||||
|   } | ||||
| ); | ||||
| 
 | ||||
| function inlineSvg(config) { | ||||
|   if (!config.module?.rules) { | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   // Alter Nx's asset rule to avoid inlining SVG if they have ?raw prepended.
 | ||||
|   const existingRule = config.module.rules.find((r) => r.test.toString() === /\.svg$/.toString()); | ||||
|   existingRule.resourceQuery = { not: [/raw/] }; | ||||
|    | ||||
|   // Add a rule for prepending ?raw SVGs.
 | ||||
|   config.module.rules.push({ | ||||
|     resourceQuery: /raw/, | ||||
|     type: 'asset/source', | ||||
|   }); | ||||
| } | ||||
| @ -15,7 +15,7 @@ export default class CutToNotePlugin extends Plugin { | ||||
|             console.log("Got ", scissorsIcon); | ||||
| 			view.set( { | ||||
| 				label: 'Cut & paste selection to sub-note', | ||||
| 				// icon: scissorsIcon,
 | ||||
| 				icon: scissorsIcon, | ||||
| 				tooltip: true | ||||
| 			} ); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran