fix URL detection in cell rendering
@@ -109,15 +109,25 @@ DataTableCellUI.prototype._render = function() {
divContent.appendChild(span).appendChild(document.createTextNode('\u00A0'));
spanArr = [];
}
+ var [realURL, extra] = (() => {
+ var parts = arr[i].split('\n');
+ return parts.length > 1 ? [parts[0], parts.slice(1).map((s) => ("\n" + s))] : [parts[0], []];
+ })();
+
var url = document.createElement('a');
- url.textContent = arr[i];
- url.setAttribute('href', arr[i]);
+ url.textContent = realURL;
+ url.setAttribute('href', realURL);
url.setAttribute('target', '_blank');
- if (i == arr.length-1){
+ if (i === arr.length-1){
divContent.appendChild(url)
} else {
divContent.appendChild(url).appendChild(document.createTextNode('\u00A0'));
}
+ if (extra.length > 0) {
+ for (var j=0; j<extra.length; j++) {
+ spanArr.push(extra[j]);
+ }
+ }
} else {
spanArr.push(arr[i]);
}
