Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../lib
File: codemirror.js
if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
[5000] Fix | Delete
replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);
[5001] Fix | Delete
} else if (range.head.line > end) {
[5002] Fix | Delete
indentLine(this, range.head.line, how, true);
[5003] Fix | Delete
end = range.head.line;
[5004] Fix | Delete
if (i == this.doc.sel.primIndex) ensureCursorVisible(this);
[5005] Fix | Delete
}
[5006] Fix | Delete
}
[5007] Fix | Delete
}),
[5008] Fix | Delete
[5009] Fix | Delete
// Fetch the parser token for a given character. Useful for hacks
[5010] Fix | Delete
// that want to inspect the mode state (say, for completion).
[5011] Fix | Delete
getTokenAt: function(pos, precise) {
[5012] Fix | Delete
return takeToken(this, pos, precise);
[5013] Fix | Delete
},
[5014] Fix | Delete
[5015] Fix | Delete
getLineTokens: function(line, precise) {
[5016] Fix | Delete
return takeToken(this, Pos(line), precise, true);
[5017] Fix | Delete
},
[5018] Fix | Delete
[5019] Fix | Delete
getTokenTypeAt: function(pos) {
[5020] Fix | Delete
pos = clipPos(this.doc, pos);
[5021] Fix | Delete
var styles = getLineStyles(this, getLine(this.doc, pos.line));
[5022] Fix | Delete
var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
[5023] Fix | Delete
var type;
[5024] Fix | Delete
if (ch == 0) type = styles[2];
[5025] Fix | Delete
else for (;;) {
[5026] Fix | Delete
var mid = (before + after) >> 1;
[5027] Fix | Delete
if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;
[5028] Fix | Delete
else if (styles[mid * 2 + 1] < ch) before = mid + 1;
[5029] Fix | Delete
else { type = styles[mid * 2 + 2]; break; }
[5030] Fix | Delete
}
[5031] Fix | Delete
var cut = type ? type.indexOf("cm-overlay ") : -1;
[5032] Fix | Delete
return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);
[5033] Fix | Delete
},
[5034] Fix | Delete
[5035] Fix | Delete
getModeAt: function(pos) {
[5036] Fix | Delete
var mode = this.doc.mode;
[5037] Fix | Delete
if (!mode.innerMode) return mode;
[5038] Fix | Delete
return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;
[5039] Fix | Delete
},
[5040] Fix | Delete
[5041] Fix | Delete
getHelper: function(pos, type) {
[5042] Fix | Delete
return this.getHelpers(pos, type)[0];
[5043] Fix | Delete
},
[5044] Fix | Delete
[5045] Fix | Delete
getHelpers: function(pos, type) {
[5046] Fix | Delete
var found = [];
[5047] Fix | Delete
if (!helpers.hasOwnProperty(type)) return found;
[5048] Fix | Delete
var help = helpers[type], mode = this.getModeAt(pos);
[5049] Fix | Delete
if (typeof mode[type] == "string") {
[5050] Fix | Delete
if (help[mode[type]]) found.push(help[mode[type]]);
[5051] Fix | Delete
} else if (mode[type]) {
[5052] Fix | Delete
for (var i = 0; i < mode[type].length; i++) {
[5053] Fix | Delete
var val = help[mode[type][i]];
[5054] Fix | Delete
if (val) found.push(val);
[5055] Fix | Delete
}
[5056] Fix | Delete
} else if (mode.helperType && help[mode.helperType]) {
[5057] Fix | Delete
found.push(help[mode.helperType]);
[5058] Fix | Delete
} else if (help[mode.name]) {
[5059] Fix | Delete
found.push(help[mode.name]);
[5060] Fix | Delete
}
[5061] Fix | Delete
for (var i = 0; i < help._global.length; i++) {
[5062] Fix | Delete
var cur = help._global[i];
[5063] Fix | Delete
if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
[5064] Fix | Delete
found.push(cur.val);
[5065] Fix | Delete
}
[5066] Fix | Delete
return found;
[5067] Fix | Delete
},
[5068] Fix | Delete
[5069] Fix | Delete
getStateAfter: function(line, precise) {
[5070] Fix | Delete
var doc = this.doc;
[5071] Fix | Delete
line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
[5072] Fix | Delete
return getStateBefore(this, line + 1, precise);
[5073] Fix | Delete
},
[5074] Fix | Delete
[5075] Fix | Delete
cursorCoords: function(start, mode) {
[5076] Fix | Delete
var pos, range = this.doc.sel.primary();
[5077] Fix | Delete
if (start == null) pos = range.head;
[5078] Fix | Delete
else if (typeof start == "object") pos = clipPos(this.doc, start);
[5079] Fix | Delete
else pos = start ? range.from() : range.to();
[5080] Fix | Delete
return cursorCoords(this, pos, mode || "page");
[5081] Fix | Delete
},
[5082] Fix | Delete
[5083] Fix | Delete
charCoords: function(pos, mode) {
[5084] Fix | Delete
return charCoords(this, clipPos(this.doc, pos), mode || "page");
[5085] Fix | Delete
},
[5086] Fix | Delete
[5087] Fix | Delete
coordsChar: function(coords, mode) {
[5088] Fix | Delete
coords = fromCoordSystem(this, coords, mode || "page");
[5089] Fix | Delete
return coordsChar(this, coords.left, coords.top);
[5090] Fix | Delete
},
[5091] Fix | Delete
[5092] Fix | Delete
lineAtHeight: function(height, mode) {
[5093] Fix | Delete
height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
[5094] Fix | Delete
return lineAtHeight(this.doc, height + this.display.viewOffset);
[5095] Fix | Delete
},
[5096] Fix | Delete
heightAtLine: function(line, mode) {
[5097] Fix | Delete
var end = false, lineObj;
[5098] Fix | Delete
if (typeof line == "number") {
[5099] Fix | Delete
var last = this.doc.first + this.doc.size - 1;
[5100] Fix | Delete
if (line < this.doc.first) line = this.doc.first;
[5101] Fix | Delete
else if (line > last) { line = last; end = true; }
[5102] Fix | Delete
lineObj = getLine(this.doc, line);
[5103] Fix | Delete
} else {
[5104] Fix | Delete
lineObj = line;
[5105] Fix | Delete
}
[5106] Fix | Delete
return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top +
[5107] Fix | Delete
(end ? this.doc.height - heightAtLine(lineObj) : 0);
[5108] Fix | Delete
},
[5109] Fix | Delete
[5110] Fix | Delete
defaultTextHeight: function() { return textHeight(this.display); },
[5111] Fix | Delete
defaultCharWidth: function() { return charWidth(this.display); },
[5112] Fix | Delete
[5113] Fix | Delete
setGutterMarker: methodOp(function(line, gutterID, value) {
[5114] Fix | Delete
return changeLine(this.doc, line, "gutter", function(line) {
[5115] Fix | Delete
var markers = line.gutterMarkers || (line.gutterMarkers = {});
[5116] Fix | Delete
markers[gutterID] = value;
[5117] Fix | Delete
if (!value && isEmpty(markers)) line.gutterMarkers = null;
[5118] Fix | Delete
return true;
[5119] Fix | Delete
});
[5120] Fix | Delete
}),
[5121] Fix | Delete
[5122] Fix | Delete
clearGutter: methodOp(function(gutterID) {
[5123] Fix | Delete
var cm = this, doc = cm.doc, i = doc.first;
[5124] Fix | Delete
doc.iter(function(line) {
[5125] Fix | Delete
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
[5126] Fix | Delete
line.gutterMarkers[gutterID] = null;
[5127] Fix | Delete
regLineChange(cm, i, "gutter");
[5128] Fix | Delete
if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
[5129] Fix | Delete
}
[5130] Fix | Delete
++i;
[5131] Fix | Delete
});
[5132] Fix | Delete
}),
[5133] Fix | Delete
[5134] Fix | Delete
lineInfo: function(line) {
[5135] Fix | Delete
if (typeof line == "number") {
[5136] Fix | Delete
if (!isLine(this.doc, line)) return null;
[5137] Fix | Delete
var n = line;
[5138] Fix | Delete
line = getLine(this.doc, line);
[5139] Fix | Delete
if (!line) return null;
[5140] Fix | Delete
} else {
[5141] Fix | Delete
var n = lineNo(line);
[5142] Fix | Delete
if (n == null) return null;
[5143] Fix | Delete
}
[5144] Fix | Delete
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
[5145] Fix | Delete
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
[5146] Fix | Delete
widgets: line.widgets};
[5147] Fix | Delete
},
[5148] Fix | Delete
[5149] Fix | Delete
getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},
[5150] Fix | Delete
[5151] Fix | Delete
addWidget: function(pos, node, scroll, vert, horiz) {
[5152] Fix | Delete
var display = this.display;
[5153] Fix | Delete
pos = cursorCoords(this, clipPos(this.doc, pos));
[5154] Fix | Delete
var top = pos.bottom, left = pos.left;
[5155] Fix | Delete
node.style.position = "absolute";
[5156] Fix | Delete
node.setAttribute("cm-ignore-events", "true");
[5157] Fix | Delete
this.display.input.setUneditable(node);
[5158] Fix | Delete
display.sizer.appendChild(node);
[5159] Fix | Delete
if (vert == "over") {
[5160] Fix | Delete
top = pos.top;
[5161] Fix | Delete
} else if (vert == "above" || vert == "near") {
[5162] Fix | Delete
var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
[5163] Fix | Delete
hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
[5164] Fix | Delete
// Default to positioning above (if specified and possible); otherwise default to positioning below
[5165] Fix | Delete
if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
[5166] Fix | Delete
top = pos.top - node.offsetHeight;
[5167] Fix | Delete
else if (pos.bottom + node.offsetHeight <= vspace)
[5168] Fix | Delete
top = pos.bottom;
[5169] Fix | Delete
if (left + node.offsetWidth > hspace)
[5170] Fix | Delete
left = hspace - node.offsetWidth;
[5171] Fix | Delete
}
[5172] Fix | Delete
node.style.top = top + "px";
[5173] Fix | Delete
node.style.left = node.style.right = "";
[5174] Fix | Delete
if (horiz == "right") {
[5175] Fix | Delete
left = display.sizer.clientWidth - node.offsetWidth;
[5176] Fix | Delete
node.style.right = "0px";
[5177] Fix | Delete
} else {
[5178] Fix | Delete
if (horiz == "left") left = 0;
[5179] Fix | Delete
else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
[5180] Fix | Delete
node.style.left = left + "px";
[5181] Fix | Delete
}
[5182] Fix | Delete
if (scroll)
[5183] Fix | Delete
scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
[5184] Fix | Delete
},
[5185] Fix | Delete
[5186] Fix | Delete
triggerOnKeyDown: methodOp(onKeyDown),
[5187] Fix | Delete
triggerOnKeyPress: methodOp(onKeyPress),
[5188] Fix | Delete
triggerOnKeyUp: onKeyUp,
[5189] Fix | Delete
[5190] Fix | Delete
execCommand: function(cmd) {
[5191] Fix | Delete
if (commands.hasOwnProperty(cmd))
[5192] Fix | Delete
return commands[cmd].call(null, this);
[5193] Fix | Delete
},
[5194] Fix | Delete
[5195] Fix | Delete
triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
[5196] Fix | Delete
[5197] Fix | Delete
findPosH: function(from, amount, unit, visually) {
[5198] Fix | Delete
var dir = 1;
[5199] Fix | Delete
if (amount < 0) { dir = -1; amount = -amount; }
[5200] Fix | Delete
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
[5201] Fix | Delete
cur = findPosH(this.doc, cur, dir, unit, visually);
[5202] Fix | Delete
if (cur.hitSide) break;
[5203] Fix | Delete
}
[5204] Fix | Delete
return cur;
[5205] Fix | Delete
},
[5206] Fix | Delete
[5207] Fix | Delete
moveH: methodOp(function(dir, unit) {
[5208] Fix | Delete
var cm = this;
[5209] Fix | Delete
cm.extendSelectionsBy(function(range) {
[5210] Fix | Delete
if (cm.display.shift || cm.doc.extend || range.empty())
[5211] Fix | Delete
return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);
[5212] Fix | Delete
else
[5213] Fix | Delete
return dir < 0 ? range.from() : range.to();
[5214] Fix | Delete
}, sel_move);
[5215] Fix | Delete
}),
[5216] Fix | Delete
[5217] Fix | Delete
deleteH: methodOp(function(dir, unit) {
[5218] Fix | Delete
var sel = this.doc.sel, doc = this.doc;
[5219] Fix | Delete
if (sel.somethingSelected())
[5220] Fix | Delete
doc.replaceSelection("", null, "+delete");
[5221] Fix | Delete
else
[5222] Fix | Delete
deleteNearSelection(this, function(range) {
[5223] Fix | Delete
var other = findPosH(doc, range.head, dir, unit, false);
[5224] Fix | Delete
return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};
[5225] Fix | Delete
});
[5226] Fix | Delete
}),
[5227] Fix | Delete
[5228] Fix | Delete
findPosV: function(from, amount, unit, goalColumn) {
[5229] Fix | Delete
var dir = 1, x = goalColumn;
[5230] Fix | Delete
if (amount < 0) { dir = -1; amount = -amount; }
[5231] Fix | Delete
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
[5232] Fix | Delete
var coords = cursorCoords(this, cur, "div");
[5233] Fix | Delete
if (x == null) x = coords.left;
[5234] Fix | Delete
else coords.left = x;
[5235] Fix | Delete
cur = findPosV(this, coords, dir, unit);
[5236] Fix | Delete
if (cur.hitSide) break;
[5237] Fix | Delete
}
[5238] Fix | Delete
return cur;
[5239] Fix | Delete
},
[5240] Fix | Delete
[5241] Fix | Delete
moveV: methodOp(function(dir, unit) {
[5242] Fix | Delete
var cm = this, doc = this.doc, goals = [];
[5243] Fix | Delete
var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();
[5244] Fix | Delete
doc.extendSelectionsBy(function(range) {
[5245] Fix | Delete
if (collapse)
[5246] Fix | Delete
return dir < 0 ? range.from() : range.to();
[5247] Fix | Delete
var headPos = cursorCoords(cm, range.head, "div");
[5248] Fix | Delete
if (range.goalColumn != null) headPos.left = range.goalColumn;
[5249] Fix | Delete
goals.push(headPos.left);
[5250] Fix | Delete
var pos = findPosV(cm, headPos, dir, unit);
[5251] Fix | Delete
if (unit == "page" && range == doc.sel.primary())
[5252] Fix | Delete
addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top);
[5253] Fix | Delete
return pos;
[5254] Fix | Delete
}, sel_move);
[5255] Fix | Delete
if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)
[5256] Fix | Delete
doc.sel.ranges[i].goalColumn = goals[i];
[5257] Fix | Delete
}),
[5258] Fix | Delete
[5259] Fix | Delete
// Find the word at the given position (as returned by coordsChar).
[5260] Fix | Delete
findWordAt: function(pos) {
[5261] Fix | Delete
var doc = this.doc, line = getLine(doc, pos.line).text;
[5262] Fix | Delete
var start = pos.ch, end = pos.ch;
[5263] Fix | Delete
if (line) {
[5264] Fix | Delete
var helper = this.getHelper(pos, "wordChars");
[5265] Fix | Delete
if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
[5266] Fix | Delete
var startChar = line.charAt(start);
[5267] Fix | Delete
var check = isWordChar(startChar, helper)
[5268] Fix | Delete
? function(ch) { return isWordChar(ch, helper); }
[5269] Fix | Delete
: /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
[5270] Fix | Delete
: function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
[5271] Fix | Delete
while (start > 0 && check(line.charAt(start - 1))) --start;
[5272] Fix | Delete
while (end < line.length && check(line.charAt(end))) ++end;
[5273] Fix | Delete
}
[5274] Fix | Delete
return new Range(Pos(pos.line, start), Pos(pos.line, end));
[5275] Fix | Delete
},
[5276] Fix | Delete
[5277] Fix | Delete
toggleOverwrite: function(value) {
[5278] Fix | Delete
if (value != null && value == this.state.overwrite) return;
[5279] Fix | Delete
if (this.state.overwrite = !this.state.overwrite)
[5280] Fix | Delete
addClass(this.display.cursorDiv, "CodeMirror-overwrite");
[5281] Fix | Delete
else
[5282] Fix | Delete
rmClass(this.display.cursorDiv, "CodeMirror-overwrite");
[5283] Fix | Delete
[5284] Fix | Delete
signal(this, "overwriteToggle", this, this.state.overwrite);
[5285] Fix | Delete
},
[5286] Fix | Delete
hasFocus: function() { return this.display.input.getField() == activeElt(); },
[5287] Fix | Delete
isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); },
[5288] Fix | Delete
[5289] Fix | Delete
scrollTo: methodOp(function(x, y) {
[5290] Fix | Delete
if (x != null || y != null) resolveScrollToPos(this);
[5291] Fix | Delete
if (x != null) this.curOp.scrollLeft = x;
[5292] Fix | Delete
if (y != null) this.curOp.scrollTop = y;
[5293] Fix | Delete
}),
[5294] Fix | Delete
getScrollInfo: function() {
[5295] Fix | Delete
var scroller = this.display.scroller;
[5296] Fix | Delete
return {left: scroller.scrollLeft, top: scroller.scrollTop,
[5297] Fix | Delete
height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
[5298] Fix | Delete
width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
[5299] Fix | Delete
clientHeight: displayHeight(this), clientWidth: displayWidth(this)};
[5300] Fix | Delete
},
[5301] Fix | Delete
[5302] Fix | Delete
scrollIntoView: methodOp(function(range, margin) {
[5303] Fix | Delete
if (range == null) {
[5304] Fix | Delete
range = {from: this.doc.sel.primary().head, to: null};
[5305] Fix | Delete
if (margin == null) margin = this.options.cursorScrollMargin;
[5306] Fix | Delete
} else if (typeof range == "number") {
[5307] Fix | Delete
range = {from: Pos(range, 0), to: null};
[5308] Fix | Delete
} else if (range.from == null) {
[5309] Fix | Delete
range = {from: range, to: null};
[5310] Fix | Delete
}
[5311] Fix | Delete
if (!range.to) range.to = range.from;
[5312] Fix | Delete
range.margin = margin || 0;
[5313] Fix | Delete
[5314] Fix | Delete
if (range.from.line != null) {
[5315] Fix | Delete
resolveScrollToPos(this);
[5316] Fix | Delete
this.curOp.scrollToPos = range;
[5317] Fix | Delete
} else {
[5318] Fix | Delete
var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),
[5319] Fix | Delete
Math.min(range.from.top, range.to.top) - range.margin,
[5320] Fix | Delete
Math.max(range.from.right, range.to.right),
[5321] Fix | Delete
Math.max(range.from.bottom, range.to.bottom) + range.margin);
[5322] Fix | Delete
this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
[5323] Fix | Delete
}
[5324] Fix | Delete
}),
[5325] Fix | Delete
[5326] Fix | Delete
setSize: methodOp(function(width, height) {
[5327] Fix | Delete
var cm = this;
[5328] Fix | Delete
function interpret(val) {
[5329] Fix | Delete
return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
[5330] Fix | Delete
}
[5331] Fix | Delete
if (width != null) cm.display.wrapper.style.width = interpret(width);
[5332] Fix | Delete
if (height != null) cm.display.wrapper.style.height = interpret(height);
[5333] Fix | Delete
if (cm.options.lineWrapping) clearLineMeasurementCache(this);
[5334] Fix | Delete
var lineNo = cm.display.viewFrom;
[5335] Fix | Delete
cm.doc.iter(lineNo, cm.display.viewTo, function(line) {
[5336] Fix | Delete
if (line.widgets) for (var i = 0; i < line.widgets.length; i++)
[5337] Fix | Delete
if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, "widget"); break; }
[5338] Fix | Delete
++lineNo;
[5339] Fix | Delete
});
[5340] Fix | Delete
cm.curOp.forceUpdate = true;
[5341] Fix | Delete
signal(cm, "refresh", this);
[5342] Fix | Delete
}),
[5343] Fix | Delete
[5344] Fix | Delete
operation: function(f){return runInOp(this, f);},
[5345] Fix | Delete
[5346] Fix | Delete
refresh: methodOp(function() {
[5347] Fix | Delete
var oldHeight = this.display.cachedTextHeight;
[5348] Fix | Delete
regChange(this);
[5349] Fix | Delete
this.curOp.forceUpdate = true;
[5350] Fix | Delete
clearCaches(this);
[5351] Fix | Delete
this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
[5352] Fix | Delete
updateGutterSpace(this);
[5353] Fix | Delete
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
[5354] Fix | Delete
estimateLineHeights(this);
[5355] Fix | Delete
signal(this, "refresh", this);
[5356] Fix | Delete
}),
[5357] Fix | Delete
[5358] Fix | Delete
swapDoc: methodOp(function(doc) {
[5359] Fix | Delete
var old = this.doc;
[5360] Fix | Delete
old.cm = null;
[5361] Fix | Delete
attachDoc(this, doc);
[5362] Fix | Delete
clearCaches(this);
[5363] Fix | Delete
this.display.input.reset();
[5364] Fix | Delete
this.scrollTo(doc.scrollLeft, doc.scrollTop);
[5365] Fix | Delete
this.curOp.forceScroll = true;
[5366] Fix | Delete
signalLater(this, "swapDoc", this, old);
[5367] Fix | Delete
return old;
[5368] Fix | Delete
}),
[5369] Fix | Delete
[5370] Fix | Delete
getInputField: function(){return this.display.input.getField();},
[5371] Fix | Delete
getWrapperElement: function(){return this.display.wrapper;},
[5372] Fix | Delete
getScrollerElement: function(){return this.display.scroller;},
[5373] Fix | Delete
getGutterElement: function(){return this.display.gutters;}
[5374] Fix | Delete
};
[5375] Fix | Delete
eventMixin(CodeMirror);
[5376] Fix | Delete
[5377] Fix | Delete
// OPTION DEFAULTS
[5378] Fix | Delete
[5379] Fix | Delete
// The default configuration options.
[5380] Fix | Delete
var defaults = CodeMirror.defaults = {};
[5381] Fix | Delete
// Functions to run when options are changed.
[5382] Fix | Delete
var optionHandlers = CodeMirror.optionHandlers = {};
[5383] Fix | Delete
[5384] Fix | Delete
function option(name, deflt, handle, notOnInit) {
[5385] Fix | Delete
CodeMirror.defaults[name] = deflt;
[5386] Fix | Delete
if (handle) optionHandlers[name] =
[5387] Fix | Delete
notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
[5388] Fix | Delete
}
[5389] Fix | Delete
[5390] Fix | Delete
// Passed to option handlers when there is no old value.
[5391] Fix | Delete
var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
[5392] Fix | Delete
[5393] Fix | Delete
// These two are, on init, called from the constructor because they
[5394] Fix | Delete
// have to be initialized before the editor can start at all.
[5395] Fix | Delete
option("value", "", function(cm, val) {
[5396] Fix | Delete
cm.setValue(val);
[5397] Fix | Delete
}, true);
[5398] Fix | Delete
option("mode", null, function(cm, val) {
[5399] Fix | Delete
cm.doc.modeOption = val;
[5400] Fix | Delete
loadMode(cm);
[5401] Fix | Delete
}, true);
[5402] Fix | Delete
[5403] Fix | Delete
option("indentUnit", 2, loadMode, true);
[5404] Fix | Delete
option("indentWithTabs", false);
[5405] Fix | Delete
option("smartIndent", true);
[5406] Fix | Delete
option("tabSize", 4, function(cm) {
[5407] Fix | Delete
resetModeState(cm);
[5408] Fix | Delete
clearCaches(cm);
[5409] Fix | Delete
regChange(cm);
[5410] Fix | Delete
}, true);
[5411] Fix | Delete
option("lineSeparator", null, function(cm, val) {
[5412] Fix | Delete
cm.doc.lineSep = val;
[5413] Fix | Delete
if (!val) return;
[5414] Fix | Delete
var newBreaks = [], lineNo = cm.doc.first;
[5415] Fix | Delete
cm.doc.iter(function(line) {
[5416] Fix | Delete
for (var pos = 0;;) {
[5417] Fix | Delete
var found = line.text.indexOf(val, pos);
[5418] Fix | Delete
if (found == -1) break;
[5419] Fix | Delete
pos = found + val.length;
[5420] Fix | Delete
newBreaks.push(Pos(lineNo, found));
[5421] Fix | Delete
}
[5422] Fix | Delete
lineNo++;
[5423] Fix | Delete
});
[5424] Fix | Delete
for (var i = newBreaks.length - 1; i >= 0; i--)
[5425] Fix | Delete
replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))
[5426] Fix | Delete
});
[5427] Fix | Delete
option("specialChars", /[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) {
[5428] Fix | Delete
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
[5429] Fix | Delete
if (old != CodeMirror.Init) cm.refresh();
[5430] Fix | Delete
});
[5431] Fix | Delete
option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);
[5432] Fix | Delete
option("electricChars", true);
[5433] Fix | Delete
option("inputStyle", mobile ? "contenteditable" : "textarea", function() {
[5434] Fix | Delete
throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME
[5435] Fix | Delete
}, true);
[5436] Fix | Delete
option("spellcheck", false, function(cm, val) {
[5437] Fix | Delete
cm.getInputField().spellcheck = val
[5438] Fix | Delete
}, true);
[5439] Fix | Delete
option("rtlMoveVisually", !windows);
[5440] Fix | Delete
option("wholeLineUpdateBefore", true);
[5441] Fix | Delete
[5442] Fix | Delete
option("theme", "default", function(cm) {
[5443] Fix | Delete
themeChanged(cm);
[5444] Fix | Delete
guttersChanged(cm);
[5445] Fix | Delete
}, true);
[5446] Fix | Delete
option("keyMap", "default", function(cm, val, old) {
[5447] Fix | Delete
var next = getKeyMap(val);
[5448] Fix | Delete
var prev = old != CodeMirror.Init && getKeyMap(old);
[5449] Fix | Delete
if (prev && prev.detach) prev.detach(cm, next);
[5450] Fix | Delete
if (next.attach) next.attach(cm, prev || null);
[5451] Fix | Delete
});
[5452] Fix | Delete
option("extraKeys", null);
[5453] Fix | Delete
[5454] Fix | Delete
option("lineWrapping", false, wrappingChanged, true);
[5455] Fix | Delete
option("gutters", [], function(cm) {
[5456] Fix | Delete
setGuttersForLineNumbers(cm.options);
[5457] Fix | Delete
guttersChanged(cm);
[5458] Fix | Delete
}, true);
[5459] Fix | Delete
option("fixedGutter", true, function(cm, val) {
[5460] Fix | Delete
cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
[5461] Fix | Delete
cm.refresh();
[5462] Fix | Delete
}, true);
[5463] Fix | Delete
option("coverGutterNextToScrollbar", false, function(cm) {updateScrollbars(cm);}, true);
[5464] Fix | Delete
option("scrollbarStyle", "native", function(cm) {
[5465] Fix | Delete
initScrollbars(cm);
[5466] Fix | Delete
updateScrollbars(cm);
[5467] Fix | Delete
cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
[5468] Fix | Delete
cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
[5469] Fix | Delete
}, true);
[5470] Fix | Delete
option("lineNumbers", false, function(cm) {
[5471] Fix | Delete
setGuttersForLineNumbers(cm.options);
[5472] Fix | Delete
guttersChanged(cm);
[5473] Fix | Delete
}, true);
[5474] Fix | Delete
option("firstLineNumber", 1, guttersChanged, true);
[5475] Fix | Delete
option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
[5476] Fix | Delete
option("showCursorWhenSelecting", false, updateSelection, true);
[5477] Fix | Delete
[5478] Fix | Delete
option("resetSelectionOnContextMenu", true);
[5479] Fix | Delete
option("lineWiseCopyCut", true);
[5480] Fix | Delete
[5481] Fix | Delete
option("readOnly", false, function(cm, val) {
[5482] Fix | Delete
if (val == "nocursor") {
[5483] Fix | Delete
onBlur(cm);
[5484] Fix | Delete
cm.display.input.blur();
[5485] Fix | Delete
cm.display.disabled = true;
[5486] Fix | Delete
} else {
[5487] Fix | Delete
cm.display.disabled = false;
[5488] Fix | Delete
}
[5489] Fix | Delete
cm.display.input.readOnlyChanged(val)
[5490] Fix | Delete
});
[5491] Fix | Delete
option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);
[5492] Fix | Delete
option("dragDrop", true, dragDropChanged);
[5493] Fix | Delete
option("allowDropFileTypes", null);
[5494] Fix | Delete
[5495] Fix | Delete
option("cursorBlinkRate", 530);
[5496] Fix | Delete
option("cursorScrollMargin", 0);
[5497] Fix | Delete
option("cursorHeight", 1, updateSelection, true);
[5498] Fix | Delete
option("singleCursorHeightPerLine", true, updateSelection, true);
[5499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function