• (二)CodeMirror


    theme: string

    theme:'monokai'  

    引入对应的css, <link rel="stylesheet" href="../theme/monokai.css">

    indentUnit: integer

    缩进,默认2

    keyMap: string

    keyMap: "sublime"  使用sublime中快捷键

    引入对应的js, <script src="../keymap/sublime.js"></script>

    extraKeys: object

    自定义快捷键

      extraKeys: {"Ctrl-Q": "autocomplete"}

      需引入:

      <script src="../addon/hint/show-hint.js"></script>
      <script src="../addon/hint/javascript-hint.js"></script>
      <link rel="stylesheet" href="../addon/hint/show-hint.css">

    // tab键
    extraKeys: {
        "Tab": function(cm){
             var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
             cm.replaceSelection(spaces);
        }
    }
    1 //全屏
    2 extraKeys:{
    3     "F11": function(cm) {
    4         cm.setOption("fullScreen", !cm.getOption("fullScreen"));
    5     },
    6     "Esc": function(cm) {
    7         if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
    8     }
    9 }

    gutters: array<string>

    自定义lineNumber

    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter","CodeMirror-lint-markers"]

      CodeMirror-foldgutter:展开收起

      需引入:

        <link rel="stylesheet" href="../addon/fold/foldgutter.css" />

        <script src="../addon/fold/foldcode.js"></script>

        <script src="../addon/fold/brace-fold.js"></script>

        <script src="../addon/fold/brace-fold.js"></script>

       CodeMirror-lint-markers:代码错误检测

      需引入:

      <script src="http://ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>

      <script src="http://rawgithub.com/zaach/jsonlint/79b553fb65c192add9066da64043458981b3972b/lib/jsonlint.js"></script>

      <script src="http://rawgithub.com/stubbornella/csslint/master/release/csslint.js"></script>

      <script src="../addon/lint/lint.js"></script>

      <script src="../addon/lint/javascript-lint.js"></script>

      <script src="../addon/lint/json-lint.js"></script>

      <script src="../addon/lint/css-lint.js"></script>

      <link rel="stylesheet" href="../addon/lint/lint.css">

  • 相关阅读:
    PRML 读书记录
    What’s the difference between Taxonomies and Ontologies? Ask Dr. Search
    C#中IP地址转换为数值的方法
    [转]读《简约至上》有感 及我的支语片言
    读《一名毕业生的程序员之路》有感
    [转载]温故知新 javascript 正则表达式
    [转]jQuery 1.9 移除了 $.browser 的替代方法
    QQ网盘首页,这样也能上线!做产品的人是白痴啊!
    [转]P3P解决cookie存取的跨域问题
    【转】跨浏览器“复制到粘贴板”JavaScript代码
  • 原文地址:https://www.cnblogs.com/huair_12/p/4115450.html
Copyright © 2020-2023  润新知