diff --git a/views/default.handlebars b/views/default.handlebars index f01d626d..2913ee45 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1708,6 +1708,19 @@ mainUpdate(512); }, 200); + // open notes markdown links in new tab + if (DOMPurify) { + DOMPurify.addHook('afterSanitizeAttributes', function (node) { + if ('target' in node) { + node.setAttribute('target', '_blank'); + node.setAttribute('rel', 'noopener noreferrer'); + } + if (!node.hasAttribute('target') && (node.hasAttribute('xlink:href') || node.hasAttribute('href'))) { + node.setAttribute('xlink:show', 'new'); + } + }); + } + // Connect to the mesh server meshserver = MeshServerCreateControl(domainUrl); meshserver.onStateChanged = onStateChanged; diff --git a/views/default3.handlebars b/views/default3.handlebars index 90f201a3..887f936e 100644 --- a/views/default3.handlebars +++ b/views/default3.handlebars @@ -2369,6 +2369,19 @@ mainUpdate(512); }, 200); + // open notes markdown links in new tab + if (DOMPurify) { + DOMPurify.addHook('afterSanitizeAttributes', function (node) { + if ('target' in node) { + node.setAttribute('target', '_blank'); + node.setAttribute('rel', 'noopener noreferrer'); + } + if (!node.hasAttribute('target') && (node.hasAttribute('xlink:href') || node.hasAttribute('href'))) { + node.setAttribute('xlink:show', 'new'); + } + }); + } + // Connect to the mesh server meshserver = MeshServerCreateControl(domainUrl); meshserver.onStateChanged = onStateChanged;