Full white space rendering and links fix (#11238)

(cherry picked from commit 37621a9f90)
This commit is contained in:
marthasharkey 2024-10-03 17:01:26 +01:00 committed by James Dunkerley
parent 4d92448566
commit ff45b85f9c

View File

@ -218,10 +218,6 @@ function formatText(params: ICellRendererParams) {
.replaceAll('&', '&')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
.replace(
/https?:\/\/([-()_.!~*';/?:@&=+$,A-Za-z0-9])+/g,
(url: string) => `<a href="${url}" target="_blank" class="link">${url}</a>`,
)
if (textFormatterSelected.value === TextFormatOptions.Off) {
return htmlEscaped.replace(/^\s+|\s+$/g, '&nbsp;')
@ -245,7 +241,12 @@ function formatText(params: ICellRendererParams) {
return `<span style="color: #df8800">${match.replaceAll(' ', '&#183;')}</span>`
})
const replaceReturns = replaceSpaces.replace(
const replaceLinks = replaceSpaces.replace(
/https?:\/\/([-()_.!~*';/?:@&=+$,A-Za-z0-9])+/g,
(url: string) => `<a href="${url}" target="_blank" class="link">${url}</a>`,
)
const replaceReturns = replaceLinks.replace(
/\r\n/g,
'<span style="color: #df8800">␍␊</span> <br>',
)