fix: Render links with target attribute (#4685)
This commit is contained in:
@@ -6,3 +6,15 @@ export const escapeHtml = (unsafe = '') => {
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
};
|
||||
|
||||
export const afterSanitizeAttributes = currentNode => {
|
||||
if ('target' in currentNode) {
|
||||
currentNode.setAttribute('target', '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
export const domPurifyConfig = {
|
||||
hooks: {
|
||||
afterSanitizeAttributes,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user