I have an Angular 19 app that displays a tree of topics. Clicking a topic loads a document into CodeMirror from a nodejs, mysql backend. Documents can be of various types, html, js, text, json, etc. The backend also stores the mode for each document. So, I have a situation of a single editor that needs to have its mode set to the type of document data loaded into it.
My question is how can I set the mode when the document is loaded into cm for each topic? Following example code, at present I can only set the mode to a singular type in cm ‘mode’ option (which is working fine). But I need to be able to set the mode for different file types when data is loaded into the cm editor corresponding to the mode of the specific topic.
Many thanks to everyone who produced this great editor and for help getting a newbie up and running.