Sha256: da6abbf7fbaa58fb010658ae17aff4f8f5dbfcd9c9d65513db182b68371e3454

Contents?: true

Size: 925 Bytes

Versions: 12

Compression:

Stored size: 925 Bytes

Contents

(function() {
  CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
    var pos = cm.getCursor(), token = cm.getTokenAt(pos);
    var space;
    if (token.className == "string") {
      var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end});
      var listStart = /\*|\d+\./, listContinue;
      if (token.string.search(listStart) == 0) {
        var reg = /^[\W]*(\d+)\./g;
        var matches = reg.exec(full);
        if(matches)
          listContinue = (parseInt(matches[1]) + 1) + ".  ";
        else
          listContinue = "*   ";
        space = full.slice(0, token.start);
        if (!/^\s*$/.test(space)) {
          space = "";
          for (var i = 0; i < token.start; ++i) space += " ";
        }
      }
    }

    if (space != null)
      cm.replaceSelection("\n" + space + listContinue, "end");
    else
      cm.execCommand("newlineAndIndent");
  };
})();

Version data entries

12 entries across 11 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.0.2.7 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2.6 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2.5 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2.4 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2.2 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2.1 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
glebtv-ckeditor-4.0.2 vendor/assets/javascripts/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js
codemirror-rails-3.02 vendor/assets/javascripts/codemirror/utils/continuelist.js
swagr-0.0.10 examples/examples01/static/js/codemirror/lib/util/continuelist.js
swagr-0.0.8 templates/static/js/codemirror/lib/util/continuelist.js
swagr-0.0.8 examples/examples01/static/js/codemirror/lib/util/continuelist.js
codemirror-rails-3.00 vendor/assets/javascripts/codemirror/utils/continuelist.js