yamleditor.htm 1.2 KB

1234567891011121314151617181920212223242526
  1. <%+cbi/valueheader%>
  2. <script src="/luci-static/resources/codemirror/lib/codemirror.js"></script>
  3. <link rel="stylesheet" href="/luci-static/resources/codemirror/lib/codemirror.css"/>
  4. <script src="/luci-static/resources/codemirror/mode/yaml/yaml.js"></script>
  5. <link rel="stylesheet" href="/luci-static/resources/codemirror/theme/dracula.css"/>
  6. <link rel="stylesheet" href="/luci-static/resources/codemirror/addon/fold/foldgutter.css"/>
  7. <script src="/luci-static/resources/codemirror/addon/fold/foldcode.js"></script>
  8. <script src="/luci-static/resources/codemirror/addon/fold/foldgutter.js"></script>
  9. <script src="/luci-static/resources/codemirror/addon/fold/indent-fold.js"></script>
  10. <script type="text/javascript">//<![CDATA[
  11. var editor = CodeMirror.fromTextArea(document.getElementById("cbid.AdGuardHome.AdGuardHome.escconf"), {
  12. mode: "text/yaml", //实现groovy代码高亮
  13. styleActiveLine: true,
  14. lineNumbers: true, //显示行号
  15. theme: "dracula", //设置主题
  16. lineWrapping: true, //代码折叠
  17. foldGutter: true,
  18. gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
  19. matchBrackets: true,//括号匹配
  20. foldGutter: true
  21. }
  22. );
  23. //]]>
  24. </script>
  25. <%+cbi/valuefooter%>