mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
open html links in a new tab
This commit is contained in:
parent
d03198c851
commit
221cf8519a
@ -1,5 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
||||
// set all elements owning target to target=_blank
|
||||
if ('target' in node) {
|
||||
node.setAttribute('target', '_blank');
|
||||
}
|
||||
// set non-HTML/MathML links to xlink:show=new
|
||||
if (
|
||||
!node.hasAttribute('target') &&
|
||||
(node.hasAttribute('xlink:href') || node.hasAttribute('href'))
|
||||
) {
|
||||
node.setAttribute('xlink:show', 'new');
|
||||
}
|
||||
});
|
||||
|
||||
Vue.prototype.$sanitize = DOMPurify.sanitize
|
||||
|
||||
var debounce = function(callback, wait) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user