EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Wysiwyg do not open anchor links in new tab
Yurii281e5aaf9d47
diff --git a/client/src/views/fields/wysiwyg.ts b/client/src/views/fields/wysiwyg.tsindex 49d321f366..087fbd4649 100644--- a/client/src/views/fields/wysiwyg.ts+++ b/client/src/views/fields/wysiwyg.ts@@ -412,11 +412,19 @@ class WysiwygFieldView <return;}+ const documentElement = iframeElement.contentWindow.document;+$iframe.on('load', () => {- $iframe.contents().find('a').attr('target', '_blank');- });+ documentElement.querySelectorAll('a').forEach(a => {+ const href = a.getAttribute('href');- const documentElement = iframeElement.contentWindow.document;+ if (href && href.startsWith('#')) {+ return;+ }++ a.setAttribute('target', '_blank');+ });+ });let bodyHtml = this.getValueForIframe();