Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaroldi committed Dec 9, 2022
1 parent 5d4a80d commit 0337621
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ const HTTPS = 'https:';
* @param sanitizingOption the sanitizingOption of BeforePasteEvent
* */
export default function sanitizeLinks(sanitizingOption: Required<HtmlSanitizerOptions>) {
['href'].forEach(property => {
chainSanitizerCallback(
sanitizingOption.attributeCallbacks,
property,
(value: string, element: HTMLElement) => validateLink(value, element)
);
});
chainSanitizerCallback(
sanitizingOption.attributeCallbacks,
'href',
(value: string, element: HTMLElement) => validateLink(value, element)
);
}

function validateLink(link: string, htmlElement: HTMLElement) {
Expand Down

0 comments on commit 0337621

Please sign in to comment.