summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorMatthias Bartelmeß <mba@fourplusone.de>2012-02-19 14:11:32 +0100
committerMatthias Bartelmeß <mba@fourplusone.de>2012-02-19 14:11:32 +0100
commita66e01a08fd8c82cc1976a26b9435fde3ac06fb3 (patch)
treea96743ab5de9aef2c9d6c82efbfcc60de31f720d /static
parent77dbe4646e1f88030bbf605ed4ee811dc3fb95de (diff)
downloadetherpad-lite-a66e01a08fd8c82cc1976a26b9435fde3ac06fb3.zip
moving noop and identity helper functions to ace2_common
Diffstat (limited to 'static')
-rw-r--r--static/js/ace2_common.js5
-rw-r--r--static/js/ace2_inner.js10
-rw-r--r--static/js/domline.js23
3 files changed, 17 insertions, 21 deletions
diff --git a/static/js/ace2_common.js b/static/js/ace2_common.js
index b4c72a92..0f8195fa 100644
--- a/static/js/ace2_common.js
+++ b/static/js/ace2_common.js
@@ -141,6 +141,9 @@ function htmlPrettyEscape(str)
return Security.escapeHTML(str).replace(/\r?\n/g, '\\n');
}
+var noop = function(){};
+var identity = function(x){return x};
+
exports.isNodeText = isNodeText;
exports.object = object;
exports.extend = extend;
@@ -155,3 +158,5 @@ exports.binarySearch = binarySearch;
exports.binarySearchInfinite = binarySearchInfinite;
exports.htmlPrettyEscape = htmlPrettyEscape;
exports.map = map;
+exports.noop = noop;
+exports.identity = identity;
diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js
index 4f936e59..de04c067 100644
--- a/static/js/ace2_inner.js
+++ b/static/js/ace2_inner.js
@@ -21,6 +21,7 @@
*/
var Ace2Common = require('/ace2_common');
+
// Extract useful method defined in the other module.
var isNodeText = Ace2Common.isNodeText;
var object = Ace2Common.object;
@@ -35,6 +36,7 @@ var setAssoc = Ace2Common.setAssoc;
var binarySearchInfinite = Ace2Common.binarySearchInfinite;
var htmlPrettyEscape = Ace2Common.htmlPrettyEscape;
var map = Ace2Common.map;
+var noop = Ace2Common.noop;
var makeChangesetTracker = require('/changesettracker').makeChangesetTracker;
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
// 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
diff --git a/static/js/domline.js b/static/js/domline.js
index 15528bf7..3074c9e9 100644
--- a/static/js/domline.js
+++ b/static/js/domline.js
@@ -27,16 +27,13 @@
// requires: undefined
var Security = require('/security');
+var Ace2Common = require('/ace2_common');
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 = {};
-domline.noop = function()
-{};
-domline.identity = function(x)
-{
- return x;
-};
domline.addToLineClass = function(lineClass, cls)
{
@@ -60,11 +57,11 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
{
var result = {
node: null,
- appendSpan: domline.noop,
- prepareForAdd: domline.noop,
- notifyAdded: domline.noop,
- clearSpans: domline.noop,
- finishUpdate: domline.noop,
+ appendSpan: noop,
+ prepareForAdd: noop,
+ notifyAdded: noop,
+ clearSpans: noop,
+ finishUpdate: noop,
lineMarker: 0
};
@@ -91,7 +88,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
{
return domline.processSpaces(s, doesWrap);
}
- var identity = domline.identity;
+
var perTextNodeProcess = (doesWrap ? identity : processSpaces);
var perHtmlLineProcess = (doesWrap ? processSpaces : identity);
var lineClass = 'ace-line';