mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
moving noop and identity helper functions to ace2_common
This commit is contained in:
parent
77dbe4646e
commit
a66e01a08f
3 changed files with 17 additions and 21 deletions
|
@ -141,6 +141,9 @@ function htmlPrettyEscape(str)
|
||||||
return Security.escapeHTML(str).replace(/\r?\n/g, '\\n');
|
return Security.escapeHTML(str).replace(/\r?\n/g, '\\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var noop = function(){};
|
||||||
|
var identity = function(x){return x};
|
||||||
|
|
||||||
exports.isNodeText = isNodeText;
|
exports.isNodeText = isNodeText;
|
||||||
exports.object = object;
|
exports.object = object;
|
||||||
exports.extend = extend;
|
exports.extend = extend;
|
||||||
|
@ -155,3 +158,5 @@ exports.binarySearch = binarySearch;
|
||||||
exports.binarySearchInfinite = binarySearchInfinite;
|
exports.binarySearchInfinite = binarySearchInfinite;
|
||||||
exports.htmlPrettyEscape = htmlPrettyEscape;
|
exports.htmlPrettyEscape = htmlPrettyEscape;
|
||||||
exports.map = map;
|
exports.map = map;
|
||||||
|
exports.noop = noop;
|
||||||
|
exports.identity = identity;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Ace2Common = require('/ace2_common');
|
var Ace2Common = require('/ace2_common');
|
||||||
|
|
||||||
// Extract useful method defined in the other module.
|
// Extract useful method defined in the other module.
|
||||||
var isNodeText = Ace2Common.isNodeText;
|
var isNodeText = Ace2Common.isNodeText;
|
||||||
var object = Ace2Common.object;
|
var object = Ace2Common.object;
|
||||||
|
@ -35,6 +36,7 @@ var setAssoc = Ace2Common.setAssoc;
|
||||||
var binarySearchInfinite = Ace2Common.binarySearchInfinite;
|
var binarySearchInfinite = Ace2Common.binarySearchInfinite;
|
||||||
var htmlPrettyEscape = Ace2Common.htmlPrettyEscape;
|
var htmlPrettyEscape = Ace2Common.htmlPrettyEscape;
|
||||||
var map = Ace2Common.map;
|
var map = Ace2Common.map;
|
||||||
|
var noop = Ace2Common.noop;
|
||||||
|
|
||||||
var makeChangesetTracker = require('/changesettracker').makeChangesetTracker;
|
var makeChangesetTracker = require('/changesettracker').makeChangesetTracker;
|
||||||
var colorutils = require('/colorutils').colorutils;
|
var colorutils = require('/colorutils').colorutils;
|
||||||
|
@ -145,14 +147,6 @@ var makeVirtualLineView = require('/virtual_lines').makeVirtualLineView;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function noop()
|
|
||||||
{}
|
|
||||||
|
|
||||||
function identity(x)
|
|
||||||
{
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "dmesg" is for displaying messages in the in-page output pane
|
// "dmesg" is for displaying messages in the in-page output pane
|
||||||
// visible when "?djs=1" is appended to the pad URL. It generally
|
// visible when "?djs=1" is appended to the pad URL. It generally
|
||||||
// remains a no-op unless djs is enabled, but we make a habit of
|
// remains a no-op unless djs is enabled, but we make a habit of
|
||||||
|
|
|
@ -27,16 +27,13 @@
|
||||||
// requires: undefined
|
// requires: undefined
|
||||||
|
|
||||||
var Security = require('/security');
|
var Security = require('/security');
|
||||||
|
var Ace2Common = require('/ace2_common');
|
||||||
var plugins = require('/plugins').plugins;
|
var plugins = require('/plugins').plugins;
|
||||||
var map = require('/ace2_common').map;
|
var map = Ace2Common.map;
|
||||||
|
var noop = Ace2Common.noop;
|
||||||
|
var identity = Ace2Common.identity;
|
||||||
|
|
||||||
var domline = {};
|
var domline = {};
|
||||||
domline.noop = function()
|
|
||||||
{};
|
|
||||||
domline.identity = function(x)
|
|
||||||
{
|
|
||||||
return x;
|
|
||||||
};
|
|
||||||
|
|
||||||
domline.addToLineClass = function(lineClass, cls)
|
domline.addToLineClass = function(lineClass, cls)
|
||||||
{
|
{
|
||||||
|
@ -60,11 +57,11 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
{
|
{
|
||||||
var result = {
|
var result = {
|
||||||
node: null,
|
node: null,
|
||||||
appendSpan: domline.noop,
|
appendSpan: noop,
|
||||||
prepareForAdd: domline.noop,
|
prepareForAdd: noop,
|
||||||
notifyAdded: domline.noop,
|
notifyAdded: noop,
|
||||||
clearSpans: domline.noop,
|
clearSpans: noop,
|
||||||
finishUpdate: domline.noop,
|
finishUpdate: noop,
|
||||||
lineMarker: 0
|
lineMarker: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,7 +88,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
{
|
{
|
||||||
return domline.processSpaces(s, doesWrap);
|
return domline.processSpaces(s, doesWrap);
|
||||||
}
|
}
|
||||||
var identity = domline.identity;
|
|
||||||
var perTextNodeProcess = (doesWrap ? identity : processSpaces);
|
var perTextNodeProcess = (doesWrap ? identity : processSpaces);
|
||||||
var perHtmlLineProcess = (doesWrap ? processSpaces : identity);
|
var perHtmlLineProcess = (doesWrap ? processSpaces : identity);
|
||||||
var lineClass = 'ace-line';
|
var lineClass = 'ace-line';
|
||||||
|
|
Loading…
Reference in a new issue