mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix code editor sometimes not rendering
This commit is contained in:
		
							
								
								
									
										2
									
								
								libraries/codemirror/mode/meta.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libraries/codemirror/mode/meta.js
									
									
									
									
										vendored
									
									
								
							| @@ -70,7 +70,7 @@ | |||||||
|     {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]}, |     {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]}, | ||||||
|     {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, |     {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, | ||||||
|     {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, |     {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, | ||||||
|     {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], |     {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript", "application/javascript;env=frontend", "application/javascript;env=backend"], | ||||||
|       mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, |       mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, | ||||||
|     {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, |     {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, | ||||||
|     {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, |     {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, | ||||||
|   | |||||||
| @@ -54,9 +54,6 @@ class NoteDetailCode { | |||||||
|             this.onNoteChange(() => this.ctx.noteChanged()); |             this.onNoteChange(() => this.ctx.noteChanged()); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         this.$component.show(); |  | ||||||
|  |  | ||||||
|         // this needs to happen after the element is shown, otherwise the editor won't be refreshed |  | ||||||
|         // CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check) |         // CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check) | ||||||
|         // we provide fallback |         // we provide fallback | ||||||
|         this.codeEditor.setValue(this.ctx.note.content || ""); |         this.codeEditor.setValue(this.ctx.note.content || ""); | ||||||
| @@ -68,6 +65,11 @@ class NoteDetailCode { | |||||||
|             CodeMirror.autoLoadMode(this.codeEditor, info.mode); |             CodeMirror.autoLoadMode(this.codeEditor, info.mode); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         this.show(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     show() { | ||||||
|  |         this.$component.show(); | ||||||
|         this.codeEditor.refresh(); |         this.codeEditor.refresh(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,6 +28,8 @@ class NoteDetailEmpty { | |||||||
|         this.$autoComplete.focus(); |         this.$autoComplete.focus(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|   | |||||||
| @@ -59,6 +59,8 @@ class NoteDetailFile { | |||||||
|         return utils.getHost() + "/api/notes/" + this.ctx.note.noteId + "/download"; |         return utils.getHost() + "/api/notes/" + this.ctx.note.noteId + "/download"; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|   | |||||||
| @@ -67,6 +67,8 @@ class NoteDetailImage { | |||||||
|         return utils.getHost() + `/api/notes/${this.ctx.note.noteId}/download`; |         return utils.getHost() + `/api/notes/${this.ctx.note.noteId}/download`; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|   | |||||||
| @@ -24,6 +24,8 @@ class NoteDetailProtectedSession { | |||||||
|         this.$component.show(); |         this.$component.show(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|   | |||||||
| @@ -616,6 +616,8 @@ class NoteDetailRelationMap { | |||||||
|         return JSON.stringify(this.mapData); |         return JSON.stringify(this.mapData); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |     onNoteChange() {} | ||||||
|   | |||||||
| @@ -43,6 +43,8 @@ class NoteDetailRender { | |||||||
|  |  | ||||||
|     getContent() {} |     getContent() {} | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |     onNoteChange() {} | ||||||
|   | |||||||
| @@ -45,6 +45,8 @@ class NoteDetailSearch { | |||||||
|  |  | ||||||
|     focus() {} |     focus() {} | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     onNoteChange() {} |     onNoteChange() {} | ||||||
|  |  | ||||||
|     cleanup() {} |     cleanup() {} | ||||||
|   | |||||||
| @@ -77,6 +77,8 @@ class NoteDetailText { | |||||||
|         this.$editorEl.focus(); |         this.$editorEl.focus(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     show() {} | ||||||
|  |  | ||||||
|     getEditor() { |     getEditor() { | ||||||
|         return this.textEditor; |         return this.textEditor; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -158,6 +158,7 @@ class TabContext { | |||||||
|         this.$tabContent.show(); |         this.$tabContent.show(); | ||||||
|         this.setCurrentNotePathToHash(); |         this.setCurrentNotePathToHash(); | ||||||
|         this.setTitleBar(); |         this.setTitleBar(); | ||||||
|  |         this.getComponent().show(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     setTitleBar() { |     setTitleBar() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user