mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Anchor tag placed with target="_blank" not opened in new tab in HTML viewer widget (#5883)
* fix :: queryname not updating in header while editing and saving in sidebar * fix :: added hook to open a tags in new window * revert :: code
This commit is contained in:
parent
8017c3cea9
commit
bdc9a52c19
1 changed files with 7 additions and 0 deletions
|
|
@ -13,6 +13,13 @@ export const Html = function ({ height, properties, styles, darkMode, dataCy })
|
|||
useEffect(() => {
|
||||
setRawHtml(stringifyHTML);
|
||||
}, [stringifyHTML]);
|
||||
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
||||
// set all elements owning target to target=_blank
|
||||
if ('target' in node) {
|
||||
node.setAttribute('target', '_blank');
|
||||
node.setAttribute('rel', 'noopener');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div style={{ display: visibility ? '' : 'none', width: '100%', height, overflowY: 'auto' }} data-cy={dataCy}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue