笙默考试管理系统-MyExamTest----codemirror(35)

笙默考试管理系统-MyExamTest----codemirror(35

目录

一、 笙默考试管理系统-MyExamTest

二、 笙默考试管理系统-MyExamTest

三、 笙默考试管理系统-MyExamTest

四、 笙默考试管理系统-MyExamTest

五、 笙默考试管理系统-MyExamTest

  • 笙默考试管理系统-MyExamTest

  return {start: stream.start,

                end: stream.pos,

                string: stream.current(),

                className: style || null,

                state: state};

        },

        indentation: function(tabSize) {return countColumn(this.text, null, tabSize);},

        // Produces an HTML fragment for the line, taking selection,

        // marking, and highlighting into account.

        getHTML: function(sfrom, sto, includePre, tabText, endAt) {

            var html = [], first = true;

            if (includePre)

  • 笙默考试管理系统-MyExamTest

                html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");

            function span(text, style) {

                if (!text) return;

                // Work around a bug where, in some compat modes, IE ignores leading spaces

                if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1);

                first = false;

                if (style) html.push('<span class="', style, '">', htmlEscape(text).replace(/\t/g, tabText), "</span>");

                else html.push(htmlEscape(text).replace(/\t/g, tabText));

            }

  • 笙默考试管理系统-MyExamTest

            var st = this.styles, allText = this.text, marked = this.marked;

            if (sfrom == sto) sfrom = null;

            var len = allText.length;

            if (endAt != null) len = Math.min(endAt, len);

  • 笙默考试管理系统-MyExamTest

            if (!allText && endAt == null)

                span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);

            else if (!marked && sfrom == null)

                for (var i = 0, ch = 0; ch < len; i+=2) {

                    var str = st[i], style = st[i+1], l = str.length;

                    if (ch + l > len) str = str.slice(0, len - ch);

                    ch += l;

                    span(str, style && "cm-" + style);

                }

            else {

                var pos = 0, i = 0, text = "", style, sg = 0;

                var markpos = -1, mark = null;

                function nextMark() {

                    if (marked) {

                        markpos += 1;

                        mark = (markpos < marked.length) ? marked[markpos] : null;

                    }

                }

  • 笙默考试管理系统-MyExamTest

                nextMark();

                while (pos < len) {

                    var upto = len;

                    var extraStyle = "";

                    if (sfrom != null) {

                        if (sfrom > pos) upto = sfrom;

                        else if (sto == null || sto > pos) {

                            extraStyle = " CodeMirror-selected";

                            if (sto != null) upto = Math.min(upto, sto);

                        }

                    }

                    while (mark && mark.to != null && mark.to <= pos) nextMark();

                    if (mark) {

                        if (mark.from > pos) upto = Math.min(upto, mark.from);

                        else {

                            extraStyle += " " + mark.style;

                            if (mark.to != null) upto = Math.min(upto, mark.to);

                        }

                    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

N201871643

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值