mirror of https://github.com/xwiki-labs/cryptpad
Move stripTags function to Util
This commit is contained in:
parent
0636714829
commit
6ae5da3d10
|
@ -319,6 +319,12 @@ define([], function () {
|
|||
return window.innerHeight < 800 || window.innerWidth < 800;
|
||||
};
|
||||
|
||||
Util.stripTags = function (text) {
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = text;
|
||||
return div.innerText;
|
||||
};
|
||||
|
||||
return Util;
|
||||
});
|
||||
}(self));
|
||||
|
|
|
@ -84,12 +84,6 @@ define([
|
|||
}
|
||||
};
|
||||
|
||||
var stripTags = function (text) {
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = text;
|
||||
return div.innerText;
|
||||
};
|
||||
|
||||
renderer.heading = function (text, level) {
|
||||
var i = 0;
|
||||
var safeText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
|
@ -105,7 +99,7 @@ define([
|
|||
toc.push({
|
||||
level: level,
|
||||
id: id,
|
||||
title: stripTags(text)
|
||||
title: Util.stripTags(text)
|
||||
});
|
||||
return "<h" + level + " id=\"" + id + "\"><a href=\"#" + id + "\" class=\"anchor\"></a>" + text + "</h" + level + ">";
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue