mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Merge pull request #3709 from PJB3005/23-03-14-mermaid-code-mode
Avoid EditableCode inheriting mode from previous notes.
This commit is contained in:
		| @@ -77,12 +77,15 @@ export default class EditableCodeTypeWidget extends TypeWidget { | |||||||
|             this.codeEditor.setValue(noteComplement.content || ""); |             this.codeEditor.setValue(noteComplement.content || ""); | ||||||
|             this.codeEditor.clearHistory(); |             this.codeEditor.clearHistory(); | ||||||
|  |  | ||||||
|             const info = CodeMirror.findModeByMIME(note.mime); |             let info = CodeMirror.findModeByMIME(note.mime); | ||||||
|  |             if (!info) { | ||||||
|  |                 // Switch back to plain text if CodeMirror does not have a mode for whatever MIME type we're editing. | ||||||
|  |                 // To avoid inheriting a mode from a previously open code note. | ||||||
|  |                 info = CodeMirror.findModeByMIME("text/plain"); | ||||||
|  |             } | ||||||
|  |  | ||||||
|             if (info) { |  | ||||||
|             this.codeEditor.setOption("mode", info.mime); |             this.codeEditor.setOption("mode", info.mime); | ||||||
|             CodeMirror.autoLoadMode(this.codeEditor, info.mode); |             CodeMirror.autoLoadMode(this.codeEditor, info.mode); | ||||||
|             } |  | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         this.show(); |         this.show(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user