Reputation: 63788
How can I tell the name of the "mode" for each language in CodeMirror?
For example, the mode "HTML Embedded" gives this page: http://codemirror.net/mode/htmlembedded/index.html
On this page, there is a script, but it doesn't set the mode.
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
continueComments: "Enter",
extraKeys: {"Ctrl-Q": "toggleComment"}
});
I would expect a mode: "somemode"
to be in this. How else can we tell the name of it?
Upvotes: 2
Views: 652
Reputation: 8929
The first mode loaded becomes the default mode. You can do editor.getMode().name
to get the name of the mode loaded in an editor instance.
Upvotes: 5