mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
fix: External links in widget not opening in new tab (#11608)
This commit is contained in:
@@ -38,16 +38,9 @@ export const openExternalLinksInNewTab = () => {
|
||||
document.addEventListener('click', event => {
|
||||
if (!isOnArticlePage) return;
|
||||
|
||||
// Some of the links come wrapped in strong tag through prosemirror
|
||||
|
||||
const isTagAnchor = event.target.tagName === 'A';
|
||||
const isParentTagAnchor =
|
||||
event.target.tagName === 'STRONG' &&
|
||||
event.target.parentNode.tagName === 'A';
|
||||
|
||||
if (isTagAnchor || isParentTagAnchor) {
|
||||
const link = isTagAnchor ? event.target : event.target.parentNode;
|
||||
const link = event.target.closest('a');
|
||||
|
||||
if (link) {
|
||||
const isInternalLink =
|
||||
link.hostname === window.location.hostname ||
|
||||
link.href.includes(customDomain) ||
|
||||
|
||||
Reference in New Issue
Block a user