table icon indicating copy to clipboard operation
table copied to clipboard

Links are not parsed

Open Jaspur opened this issue 6 years ago • 1 comments

Hi, When using an URL in a text of a column, it is not parsed correctly. Just see as a result a plain string of text.

Jaspur avatar Nov 29 '19 10:11 Jaspur

document.addEventListener("DOMContentLoaded", function() {
    const table = document.getElementById("data-table");

    function parseUrls(text) {
        const urlPattern = /(https?:\/\/[^\s]+)/g;
        return text.replace(urlPattern, '<a href="$1" target="_blank">$1</a>');
    }

    for (let row of table.rows) {
        for (let cell of row.cells) {
            cell.innerHTML = parseUrls(cell.innerHTML);
        }
    }
});

ljluestc avatar Jul 21 '24 16:07 ljluestc