如何通过codemirror启用htmlmixed模式?

How to enable htmlmixed mode by codemirror?

我想要 codemirror 中的 htmlmixed 模式。我开始在 codemirror API 中搜索,但找不到。我包括以下内容:

<script src="cm/lib/codemirror.js"></script>
<link rel="stylesheet" href="cm/lib/codemirror.css">
<script src="cm/mode/htmlmixed/htmlmixed.js"></script>

这是我的代码:

MCM = CodeMirror(JY.get("devroot"), {
    mode:  "htmlmixed",
    value: "<p>Hello</p>"
});

但是没用。有人知道吗?

您还必须包含模式脚本 cm/mode/xml/xml.jscm/mode/javascript/javascript.jscm/mode/css/css.js,它们是 htmlmixed 模式的依赖项。

@Marjin 给出了正确答案。但完整的代码将如下所示:

<script src="/js/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="/js/codemirror/lib/codemirror.css">
<script src="/js/codemirror/mode/xml/xml.js"></script>
<script src="/js/codemirror/mode/javascript/javascript.js"></script>
<script src="/js/codemirror/mode/css/css.js"></script>
<script src="/js/codemirror/mode/htmlmixed/htmlmixed.js"></script>

<div class="page-wrap-editor">
    <h3 class="editor-head">HTML код</h3>
    <textarea id="ta"></textarea>
</div>


<script>
    const ta = document.getElementById(`ta`);
    const editor = CodeMirror.fromTextArea(ta, {
        lineNumbers: true,
        mode:  "htmlmixed",
        value: "<p>Hello</p>"
    });
</script>