mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
editor: Delete commented-out code
This commit is contained in:
parent
eeead46437
commit
ab4e99f67a
3 changed files with 1 additions and 96 deletions
|
@ -108,7 +108,6 @@ exports.newLen = (cs) => exports.unpack(cs).newLen;
|
|||
* @return {Op} type object iterator
|
||||
*/
|
||||
exports.opIterator = (opsStr, optStartIndex) => {
|
||||
// print(opsStr);
|
||||
const regex = /((?:\*[0-9a-z]+)*)(?:\|([0-9a-z]+))?([-+=])([0-9a-z]+)|\?|/g;
|
||||
const startIndex = (optStartIndex || 0);
|
||||
let curIndex = startIndex;
|
||||
|
@ -644,15 +643,8 @@ exports.textLinesMutator = (lines) => {
|
|||
curLine += L;
|
||||
curCol = 0;
|
||||
}
|
||||
// print(inSplice+" / "+isCurLineInSplice()+" / "+curSplice[0]+" /
|
||||
// "+curSplice[1]+" / "+lines.length);
|
||||
/* if (inSplice && (! isCurLineInSplice()) && (curSplice[0] + curSplice[1] < lines.length)) {
|
||||
print("BLAH");
|
||||
putCurLineInSplice();
|
||||
}*/
|
||||
// tests case foo in remove(), which isn't otherwise covered in current impl
|
||||
}
|
||||
// debugPrint("skip");
|
||||
};
|
||||
|
||||
const skip = (N, L, includeInSplice) => {
|
||||
|
@ -667,7 +659,6 @@ exports.textLinesMutator = (lines) => {
|
|||
putCurLineInSplice();
|
||||
}
|
||||
curCol += N;
|
||||
// debugPrint("skip");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -684,10 +675,8 @@ exports.textLinesMutator = (lines) => {
|
|||
return lines_slice(m, m + k).join('');
|
||||
};
|
||||
if (isCurLineInSplice()) {
|
||||
// print(curCol);
|
||||
if (curCol === 0) {
|
||||
removed = curSplice[curSplice.length - 1];
|
||||
// print("FOO"); // case foo
|
||||
curSplice.length--;
|
||||
removed += nextKLinesText(L - 1);
|
||||
curSplice[1] += L - 1;
|
||||
|
@ -704,7 +693,6 @@ exports.textLinesMutator = (lines) => {
|
|||
removed = nextKLinesText(L);
|
||||
curSplice[1] += L;
|
||||
}
|
||||
// debugPrint("remove");
|
||||
}
|
||||
return removed;
|
||||
};
|
||||
|
@ -722,7 +710,6 @@ exports.textLinesMutator = (lines) => {
|
|||
removed = curSplice[sline].substring(curCol, curCol + N);
|
||||
curSplice[sline] = curSplice[sline].substring(0, curCol) +
|
||||
curSplice[sline].substring(curCol + N);
|
||||
// debugPrint("remove");
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
|
@ -736,13 +723,6 @@ exports.textLinesMutator = (lines) => {
|
|||
if (L) {
|
||||
const newLines = exports.splitTextLines(text);
|
||||
if (isCurLineInSplice()) {
|
||||
// if (curCol == 0) {
|
||||
// curSplice.length--;
|
||||
// curSplice[1]--;
|
||||
// Array.prototype.push.apply(curSplice, newLines);
|
||||
// curLine += newLines.length;
|
||||
// }
|
||||
// else {
|
||||
const sline = curSplice.length - 1;
|
||||
const theLine = curSplice[sline];
|
||||
const lineCol = curCol;
|
||||
|
@ -753,7 +733,6 @@ exports.textLinesMutator = (lines) => {
|
|||
curLine += newLines.length;
|
||||
curSplice.push(theLine.substring(lineCol));
|
||||
curCol = 0;
|
||||
// }
|
||||
} else {
|
||||
Array.prototype.push.apply(curSplice, newLines);
|
||||
curLine += newLines.length;
|
||||
|
@ -767,12 +746,10 @@ exports.textLinesMutator = (lines) => {
|
|||
curSplice[sline].substring(curCol);
|
||||
curCol += text.length;
|
||||
}
|
||||
// debugPrint("insert");
|
||||
}
|
||||
};
|
||||
|
||||
const hasMore = () => {
|
||||
// print(lines.length+" / "+inSplice+" / "+(curSplice.length - 2)+" / "+curSplice[1]);
|
||||
let docLines = lines_length();
|
||||
if (inSplice) {
|
||||
docLines += curSplice.length - 2 - curSplice[1];
|
||||
|
@ -784,7 +761,6 @@ exports.textLinesMutator = (lines) => {
|
|||
if (inSplice) {
|
||||
leaveSplice();
|
||||
}
|
||||
// debugPrint("close");
|
||||
};
|
||||
|
||||
const self = {
|
||||
|
@ -826,7 +802,6 @@ exports.applyZip = (in1, idx1, in2, idx2, func) => {
|
|||
if ((!op2.opcode) && iter2.hasNext()) iter2.next(op2);
|
||||
func(op1, op2, opOut);
|
||||
if (opOut.opcode) {
|
||||
// print(opOut.toSource());
|
||||
assem.append(opOut);
|
||||
opOut.opcode = '';
|
||||
}
|
||||
|
@ -1011,7 +986,6 @@ exports.composeAttributes = (att1, att2, resultIsMutation, pool) => {
|
|||
buf.append('*');
|
||||
buf.append(exports.numToString(pool.putAttrib(atts[i])));
|
||||
}
|
||||
// print(att1+" / "+att2+" / "+buf.toString());
|
||||
return buf.toString();
|
||||
};
|
||||
|
||||
|
@ -1023,7 +997,6 @@ exports._slicerZipperFunc = (attOp, csOp, opOut, pool) => {
|
|||
// attOp is the op from the sequence that is being operated on, either an
|
||||
// attribution string or the earlier of two exportss being composed.
|
||||
// pool can be null if definitely not needed.
|
||||
// print(csOp.toSource()+" "+attOp.toSource()+" "+opOut.toSource());
|
||||
if (attOp.opcode === '-') {
|
||||
exports.copyOp(attOp, opOut);
|
||||
attOp.opcode = '';
|
||||
|
@ -1120,15 +1093,7 @@ exports.applyToAttribution = (cs, astr, pool) => {
|
|||
(op1, op2, opOut) => exports._slicerZipperFunc(op1, op2, opOut, pool));
|
||||
};
|
||||
|
||||
/* exports.oneInsertedLineAtATimeOpIterator = function(opsStr, optStartIndex, charBank) {
|
||||
var iter = exports.opIterator(opsStr, optStartIndex);
|
||||
var bankIndex = 0;
|
||||
|
||||
};*/
|
||||
|
||||
exports.mutateAttributionLines = (cs, lines, pool) => {
|
||||
// dmesg(cs);
|
||||
// dmesg(lines.toSource()+" ->");
|
||||
const unpacked = exports.unpack(cs);
|
||||
const csIter = exports.opIterator(unpacked.ops);
|
||||
const csBank = unpacked.charBank;
|
||||
|
@ -1154,7 +1119,6 @@ exports.mutateAttributionLines = (cs, lines, pool) => {
|
|||
let lineAssem = null;
|
||||
|
||||
const outputMutOp = (op) => {
|
||||
// print("outputMutOp: "+op.toSource());
|
||||
if (!lineAssem) {
|
||||
lineAssem = exports.mergingOpAssembler();
|
||||
}
|
||||
|
@ -1174,17 +1138,12 @@ exports.mutateAttributionLines = (cs, lines, pool) => {
|
|||
if ((!csOp.opcode) && csIter.hasNext()) {
|
||||
csIter.next(csOp);
|
||||
}
|
||||
// print(csOp.toSource()+" "+attOp.toSource()+" "+opOut.toSource());
|
||||
// print(csOp.opcode+"/"+csOp.lines+"/"+csOp.attribs+"/"+lineAssem+
|
||||
// "/"+lineIter+"/"+(lineIter?lineIter.hasNext():null));
|
||||
// print("csOp: "+csOp.toSource());
|
||||
if ((!csOp.opcode) && (!attOp.opcode) && (!lineAssem) && (!(lineIter && lineIter.hasNext()))) {
|
||||
break; // done
|
||||
} else if (csOp.opcode === '=' && csOp.lines > 0 && (!csOp.attribs) &&
|
||||
(!attOp.opcode) && (!lineAssem) && (!(lineIter && lineIter.hasNext()))) {
|
||||
// skip multiple lines; this is what makes small changes not order of the document size
|
||||
mut.skipLines(csOp.lines);
|
||||
// print("skipped: "+csOp.lines);
|
||||
csOp.opcode = '';
|
||||
} else if (csOp.opcode === '+') {
|
||||
if (csOp.lines > 1) {
|
||||
|
@ -1205,7 +1164,6 @@ exports.mutateAttributionLines = (cs, lines, pool) => {
|
|||
if ((!attOp.opcode) && isNextMutOp()) {
|
||||
nextMutOp(attOp);
|
||||
}
|
||||
// print("attOp: "+attOp.toSource());
|
||||
exports._slicerZipperFunc(attOp, csOp, opOut, pool);
|
||||
if (opOut.opcode) {
|
||||
outputMutOp(opOut);
|
||||
|
@ -1216,8 +1174,6 @@ exports.mutateAttributionLines = (cs, lines, pool) => {
|
|||
|
||||
exports.assert(!lineAssem, `line assembler not finished:${cs}`);
|
||||
mut.close();
|
||||
|
||||
// dmesg("-> "+lines.toSource());
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1299,11 +1255,6 @@ exports.compose = (cs1, cs2, pool) => {
|
|||
const bankAssem = exports.stringAssembler();
|
||||
|
||||
const newOps = exports.applyZip(unpacked1.ops, 0, unpacked2.ops, 0, (op1, op2, opOut) => {
|
||||
// var debugBuilder = exports.stringAssembler();
|
||||
// debugBuilder.append(exports.opString(op1));
|
||||
// debugBuilder.append(',');
|
||||
// debugBuilder.append(exports.opString(op2));
|
||||
// debugBuilder.append(' / ');
|
||||
const op1code = op1.opcode;
|
||||
const op2code = op2.opcode;
|
||||
if (op1code === '+' && op2code === '-') {
|
||||
|
@ -1317,13 +1268,6 @@ exports.compose = (cs1, cs2, pool) => {
|
|||
bankAssem.append(bankIter1.take(opOut.chars));
|
||||
}
|
||||
}
|
||||
|
||||
// debugBuilder.append(exports.opString(op1));
|
||||
// debugBuilder.append(',');
|
||||
// debugBuilder.append(exports.opString(op2));
|
||||
// debugBuilder.append(' -> ');
|
||||
// debugBuilder.append(exports.opString(opOut));
|
||||
// print(debugBuilder.toString());
|
||||
});
|
||||
|
||||
return exports.pack(len1, len3, newOps, bankAssem.toString());
|
||||
|
@ -2196,7 +2140,6 @@ exports._slicerZipperFuncWithDeletions = (attOp, csOp, opOut, pool) => {
|
|||
// attOp is the op from the sequence that is being operated on, either an
|
||||
// attribution string or the earlier of two exportss being composed.
|
||||
// pool can be null if definitely not needed.
|
||||
// print(csOp.toSource()+" "+attOp.toSource()+" "+opOut.toSource());
|
||||
if (attOp.opcode === '-') {
|
||||
exports.copyOp(attOp, opOut);
|
||||
attOp.opcode = '';
|
||||
|
|
|
@ -301,12 +301,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
const inCallStack = (type, action) => {
|
||||
if (disposed) return;
|
||||
|
||||
if (currentCallStack) {
|
||||
// Do not uncomment this in production. It will break Etherpad being provided in iFrames.
|
||||
// I am leaving this in for testing usefulness.
|
||||
// top.console.error(`Can't enter callstack ${type}, already in ${currentCallStack.type}`);
|
||||
}
|
||||
|
||||
const newEditEvent = (eventType) => ({
|
||||
eventType,
|
||||
backset: null,
|
||||
|
@ -388,11 +382,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
if (cleanExit) {
|
||||
submitOldEvent(cs.editEvent);
|
||||
if (cs.domClean && cs.type !== 'setup') {
|
||||
// if (cs.isUserChange)
|
||||
// {
|
||||
// if (cs.repChanged) parenModule.notifyChange();
|
||||
// else parenModule.notifyTick();
|
||||
// }
|
||||
if (cs.selectionAffected) {
|
||||
updateBrowserSelectionFromRep();
|
||||
}
|
||||
|
@ -753,7 +742,7 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
let printedTrace = false;
|
||||
const isTimeUp = () => {
|
||||
if (exceededAlready) {
|
||||
if ((!printedTrace)) { // && now() - startTime - ms > 300) {
|
||||
if ((!printedTrace)) {
|
||||
printedTrace = true;
|
||||
}
|
||||
return true;
|
||||
|
@ -1176,7 +1165,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
entries.push(newEntry);
|
||||
lineNodeInfos[k] = newEntry.domInfo;
|
||||
}
|
||||
// var fragment = magicdom.wrapDom(document.createDocumentFragment());
|
||||
domInsertsNeeded.push([nodeToAddAfter, lineNodeInfos]);
|
||||
dirtyNodes.forEach((n) => {
|
||||
toDeleteAtEnd.push(n);
|
||||
|
@ -1212,11 +1200,8 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
p.mark('del');
|
||||
// delete old dom nodes
|
||||
toDeleteAtEnd.forEach((n) => {
|
||||
// var id = n.uniqueId();
|
||||
// parent of n may not be "root" in IE due to non-tree-shaped DOM (wtf)
|
||||
if (n.parentNode) n.parentNode.removeChild(n);
|
||||
|
||||
// dmesg(htmlPrettyEscape(htmlForRemovedChild(n)));
|
||||
});
|
||||
|
||||
// needed to stop chrome from breaking the ui when long strings without spaces are pasted
|
||||
|
@ -1228,7 +1213,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
// if the nodes that define the selection weren't encountered during
|
||||
// content collection, figure out where those nodes are now.
|
||||
if (selection && !selStart) {
|
||||
// if (domChanges) dmesg("selection not collected");
|
||||
const selStartFromHook = hooks.callAll('aceStartLineAndCharForPoint', {
|
||||
callstack: currentCallStack,
|
||||
editorInfo,
|
||||
|
@ -1398,9 +1382,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
const getPointForLineAndChar = (lineAndChar) => {
|
||||
const line = lineAndChar[0];
|
||||
let charsLeft = lineAndChar[1];
|
||||
// Do not uncomment this in production it will break iFrames.
|
||||
// top.console.log("line: %d, key: %s, node: %o", line, rep.lines.atIndex(line).key,
|
||||
// getCleanNodeByKey(rep.lines.atIndex(line).key));
|
||||
const lineEntry = rep.lines.atIndex(line);
|
||||
charsLeft -= lineEntry.lineMarker;
|
||||
if (charsLeft < 0) {
|
||||
|
@ -1574,7 +1555,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
throw new Error(`doRepApplyChangeset length mismatch: ${errMsg}`);
|
||||
}
|
||||
|
||||
// (function doRecordUndoInformation(changes) {
|
||||
((changes) => {
|
||||
const editEvent = currentCallStack.editEvent;
|
||||
if (editEvent.eventType === 'nonundoable') {
|
||||
|
@ -1597,7 +1577,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
}
|
||||
})(changes);
|
||||
|
||||
// rep.alltext = Changeset.applyToText(changes, rep.alltext);
|
||||
Changeset.mutateAttributionLines(changes, rep.alines, rep.apool);
|
||||
|
||||
if (changesetTracker.isTracking()) {
|
||||
|
@ -1994,7 +1973,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
theChangeset = builder.toString();
|
||||
}
|
||||
|
||||
// dmesg(htmlPrettyEscape(theChangeset));
|
||||
doRepApplyChangeset(theChangeset);
|
||||
}
|
||||
|
||||
|
@ -2170,13 +2148,8 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
}
|
||||
|
||||
return true;
|
||||
// Do not uncomment this in production it will break iFrames.
|
||||
// top.console.log("selStart: %o, selEnd: %o, focusAtStart: %s", rep.selStart, rep.selEnd,
|
||||
// String(!!rep.selFocusAtStart));
|
||||
}
|
||||
return false;
|
||||
// Do not uncomment this in production it will break iFrames.
|
||||
// top.console.log("%o %o %s", rep.selStart, rep.selEnd, rep.selFocusAtStart);
|
||||
};
|
||||
|
||||
const isPadLoading = (eventType) => (
|
||||
|
@ -2641,7 +2614,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
const tabSize = THE_TAB.length;
|
||||
const toDelete = ((col2 - 1) % tabSize) + 1;
|
||||
performDocumentReplaceRange([lineNum, col - toDelete], [lineNum, col], '');
|
||||
// scrollSelectionIntoView();
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
@ -2730,7 +2702,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
const altKey = evt.altKey;
|
||||
const shiftKey = evt.shiftKey;
|
||||
|
||||
// dmesg("keyevent type: "+type+", which: "+which);
|
||||
// Don't take action based on modifier keys going up and down.
|
||||
// Modifier keys do not generate "keypress" events.
|
||||
// 224 is the command-key under Mac Firefox.
|
||||
|
@ -2930,7 +2901,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
fastIncorp(4);
|
||||
evt.preventDefault();
|
||||
doReturnKey();
|
||||
// scrollSelectionIntoView();
|
||||
scheduler.setTimeout(() => {
|
||||
outerWin.scrollBy(-100, 0);
|
||||
}, 0);
|
||||
|
@ -2979,7 +2949,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
fastIncorp(5);
|
||||
evt.preventDefault();
|
||||
doTabKey(evt.shiftKey);
|
||||
// scrollSelectionIntoView();
|
||||
specialHandled = true;
|
||||
}
|
||||
if ((!specialHandled) &&
|
||||
|
@ -3273,7 +3242,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
if (isCollapsed) {
|
||||
const diveDeep = () => {
|
||||
while (p.node.childNodes.length > 0) {
|
||||
// && (p.node == root || p.node.parentNode == root)) {
|
||||
if (p.index === 0) {
|
||||
p.node = p.node.firstChild;
|
||||
p.maxIndex = nodeMaxIndex(p.node);
|
||||
|
@ -3514,9 +3482,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
$(document).on('click', handleClick);
|
||||
// dropdowns on edit bar need to be closed on clicks on both pad inner and pad outer
|
||||
$(outerWin.document).on('click', hideEditBarDropdowns);
|
||||
// Disabled: https://github.com/ether/etherpad-lite/issues/2546
|
||||
// Will break OL re-numbering: https://github.com/ether/etherpad-lite/pull/2533
|
||||
// $(document).on("cut", handleCut);
|
||||
|
||||
// If non-nullish, pasting on a link should be suppressed.
|
||||
let suppressPasteOnLink = null;
|
||||
|
@ -3715,7 +3680,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
|
||||
const mods = [];
|
||||
for (let n = firstLine; n <= lastLine; n++) {
|
||||
// var t = '';
|
||||
let level = 0;
|
||||
let togglingOn = true;
|
||||
const listType = /([a-z]+)([0-9]+)/.exec(getLineListType(n));
|
||||
|
@ -3726,7 +3690,6 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
}
|
||||
|
||||
if (listType) {
|
||||
// t = listType[1];
|
||||
level = Number(listType[2]);
|
||||
}
|
||||
const t = getLineListType(n);
|
||||
|
|
|
@ -356,7 +356,6 @@ that is a string.
|
|||
return self.indexOfEntry(self.atOffset(offset));
|
||||
},
|
||||
search: (entryFunc) => _search(entryFunc),
|
||||
// debugToString: _debugToString,
|
||||
debugGetPoint: _getPoint,
|
||||
debugDepth: () => start.levels,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue