codemirror 3.18 with enabled the fullscreen addon
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
"use strict";
|
||||
|
||||
function doFold(cm, pos, options) {
|
||||
var finder = options.call ? options : (options && options.rangeFinder);
|
||||
var finder = options && (options.call ? options : options.rangeFinder);
|
||||
if (!finder) finder = cm.getHelper(pos, "fold");
|
||||
if (!finder) return;
|
||||
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
|
||||
var minSize = options && options.minFoldSize || 0;
|
||||
@@ -29,12 +30,16 @@
|
||||
if (!range || range.cleared) return;
|
||||
|
||||
var myWidget = makeWidget(options);
|
||||
CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();});
|
||||
CodeMirror.on(myWidget, "mousedown", function() { myRange.clear(); });
|
||||
var myRange = cm.markText(range.from, range.to, {
|
||||
replacedWith: myWidget,
|
||||
clearOnEnter: true,
|
||||
__isFold: true
|
||||
});
|
||||
myRange.on("clear", function(from, to) {
|
||||
CodeMirror.signal(cm, "unfold", cm, from, to);
|
||||
});
|
||||
CodeMirror.signal(cm, "fold", cm, range.from, range.to);
|
||||
}
|
||||
|
||||
function makeWidget(options) {
|
||||
@@ -56,7 +61,7 @@
|
||||
// New-style interface
|
||||
CodeMirror.defineExtension("foldCode", function(pos, options) { doFold(this, pos, options); });
|
||||
|
||||
CodeMirror.combineRangeFinders = function() {
|
||||
CodeMirror.registerHelper("fold", "combine", function() {
|
||||
var funcs = Array.prototype.slice.call(arguments, 0);
|
||||
return function(cm, start) {
|
||||
for (var i = 0; i < funcs.length; ++i) {
|
||||
@@ -64,5 +69,5 @@
|
||||
if (found) return found;
|
||||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user