Skip to content

Commit

Permalink
Merge pull request #5394 from Rolf-MP/master
Browse files Browse the repository at this point in the history
Add capability for adding sanitize profiles through sanitizeConfig in options
  • Loading branch information
brendanbond authored Nov 7, 2023
2 parents 6627908 + 663ecd0 commit eb8d36c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,12 @@ export function sanitize(string, options) {
ADD_ATTR: ['ref', 'target'],
USE_PROFILES: { html: true }
};
// Use profiles
if (options.sanitizeConfig && options.sanitizeConfig.useProfiles) {
Object.keys(options.sanitizeConfig.useProfiles).forEach(key => {
sanitizeOptions.USE_PROFILES[key] = options.sanitizeConfig.useProfiles[key];
});
}
// Add attrs
if (options.sanitizeConfig && Array.isArray(options.sanitizeConfig.addAttr) && options.sanitizeConfig.addAttr.length > 0) {
options.sanitizeConfig.addAttr.forEach((attr) => {
Expand Down

0 comments on commit eb8d36c

Please sign in to comment.