[英]CodeMirror determine the name of the mode
How can I tell the name of the "mode" for each language in CodeMirror? 如何在CodeMirror中分辨每种语言的“模式”名称?
For example, the mode "HTML Embedded" gives this page: http://codemirror.net/mode/htmlembedded/index.html 例如,“ HTML Embedded”模式提供了以下页面: 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. 我希望有一个
mode: "somemode"
在其中。 How else can we tell the name of it? 我们还能如何分辨它的名称?
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. 您可以执行
editor.getMode().name
来获取在编辑器实例中加载的模式的名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.