Vergleich admin/jscripts/codemirror/addon/fold/foldgutter.js - 1.8.0 - 1.8.23

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 20Zeile 20
      cm.off("viewportChange", onViewportChange);
cm.off("fold", onFold);
cm.off("unfold", onFold);

      cm.off("viewportChange", onViewportChange);
cm.off("fold", onFold);
cm.off("unfold", onFold);

      cm.off("swapDoc", updateInViewport);

      cm.off("swapDoc", onChange);

    }
if (val) {
cm.state.foldGutter = new State(parseOptions(val));

    }
if (val) {
cm.state.foldGutter = new State(parseOptions(val));

Zeile 30Zeile 30
      cm.on("viewportChange", onViewportChange);
cm.on("fold", onFold);
cm.on("unfold", onFold);

      cm.on("viewportChange", onViewportChange);
cm.on("fold", onFold);
cm.on("unfold", onFold);

      cm.on("swapDoc", updateInViewport);

      cm.on("swapDoc", onChange);

    }
});


    }
});


Zeile 50Zeile 50
  }

function isFolded(cm, line) {

  }

function isFolded(cm, line) {

    var marks = cm.findMarksAt(Pos(line));

    var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));

    for (var i = 0; i < marks.length; ++i)

    for (var i = 0; i < marks.length; ++i)

      if (marks[i].__isFold && marks[i].find().from.line == line) return true;

      if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];

  }

function marker(spec) {

  }

function marker(spec) {

Zeile 67Zeile 67

function updateFoldInfo(cm, from, to) {
var opts = cm.state.foldGutter.options, cur = from;


function updateFoldInfo(cm, from, to) {
var opts = cm.state.foldGutter.options, cur = from;

 
    var minSize = cm.foldOption(opts, "minFoldSize");
var func = cm.foldOption(opts, "rangeFinder");

    cm.eachLine(from, to, function(line) {
var mark = null;
if (isFolded(cm, cur)) {
mark = marker(opts.indicatorFolded);
} else {

    cm.eachLine(from, to, function(line) {
var mark = null;
if (isFolded(cm, cur)) {
mark = marker(opts.indicatorFolded);
} else {

        var pos = Pos(cur, 0), func = opts.rangeFinder || CodeMirror.fold.auto;

        var pos = Pos(cur, 0);

        var range = func && func(cm, pos);

        var range = func && func(cm, pos);

        if (range && range.from.line + 1 < range.to.line)

        if (range && range.to.line - range.from.line >= minSize)

          mark = marker(opts.indicatorOpen);
}
cm.setGutterMarker(line, opts.gutter, mark);

          mark = marker(opts.indicatorOpen);
}
cm.setGutterMarker(line, opts.gutter, mark);

Zeile 92Zeile 94
  }

function onGutterClick(cm, line, gutter) {

  }

function onGutterClick(cm, line, gutter) {

    var opts = cm.state.foldGutter.options;



    var state = cm.state.foldGutter;
if (!state) return;
var opts = state.options;

    if (gutter != opts.gutter) return;

    if (gutter != opts.gutter) return;

    cm.foldCode(Pos(line, 0), opts.rangeFinder);



    var folded = isFolded(cm, line);
if (folded) folded.clear();
else cm.foldCode(Pos(line, 0), opts.rangeFinder);

  }

function onChange(cm) {

  }

function onChange(cm) {

    var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;



    var state = cm.state.foldGutter;
if (!state) return;
var opts = state.options;

    state.from = state.to = 0;
clearTimeout(state.changeUpdate);
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);

    state.from = state.to = 0;
clearTimeout(state.changeUpdate);
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);

  }

  }


function onViewportChange(cm) {


function onViewportChange(cm) {

    var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;



    var state = cm.state.foldGutter;
if (!state) return;
var opts = state.options;

    clearTimeout(state.changeUpdate);
state.changeUpdate = setTimeout(function() {
var vp = cm.getViewport();

    clearTimeout(state.changeUpdate);
state.changeUpdate = setTimeout(function() {
var vp = cm.getViewport();

Zeile 127Zeile 137
  }

function onFold(cm, from) {

  }

function onFold(cm, from) {

    var state = cm.state.foldGutter, line = from.line;



    var state = cm.state.foldGutter;
if (!state) return;
var line = from.line;

    if (line >= state.from && line < state.to)
updateFoldInfo(cm, line, line + 1);
}

    if (line >= state.from && line < state.to)
updateFoldInfo(cm, line, line + 1);
}