open note urls in new tab #4091
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
9ebd23a518
commit
fc83211e90
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue