From 88926fec10532ea4be077d3491a54a65fff9f3e3 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 26 Mar 2021 15:05:55 +0100 Subject: [PATCH] Make links inside commented text clickable in rich text --- www/pad/links.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/pad/links.js b/www/pad/links.js index a79183fa6..779257dfb 100644 --- a/www/pad/links.js +++ b/www/pad/links.js @@ -7,7 +7,10 @@ define([ var onLinkClicked = function (e, inner) { var $target = $(e.target); - if (!$target.is('a')) { return; } + if (!$target.is('a')) { + $target = $target.closest('a'); + if (!$target.length) { return; } + } var href = $target.attr('href'); if (!href) { return; } var $inner = $(inner); @@ -66,7 +69,7 @@ define([ // Bubble to open the link in a new tab $inner.click(function (e) { removeClickedLink($inner); - if (e.target.nodeName.toUpperCase() === 'A') { + if (e.target.nodeName.toUpperCase() === 'A' || $(e.target).closest('a').length) { return void onLinkClicked(e, inner); } });