mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
Version Bumps (#2677)
* chore: upgraded versions * chore: linting * fix: updated snap
This commit is contained in:
@@ -8,7 +8,8 @@ Object {
|
||||
`;
|
||||
|
||||
exports[`allows anchor tags and counts them correctly 1`] = `
|
||||
"<div>
|
||||
"
|
||||
<div>
|
||||
<a href=\\"https://mozilla.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">https://mozilla.org/</a>
|
||||
<a href=\\"https://mozilla.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">https://mozilla.org/</a>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import newDOMPurify, { DOMPurify } from "dompurify";
|
||||
import createDOMPurify from "dompurify";
|
||||
|
||||
export function createPurify<T extends boolean = true>(
|
||||
window: Window,
|
||||
returnDOM: T = true as T
|
||||
) {
|
||||
type DOMPurify = ReturnType<typeof createDOMPurify>;
|
||||
|
||||
export function createPurify(window: Window, returnDOM = true) {
|
||||
// Initializing JSDOM and DOMPurify
|
||||
const purify = newDOMPurify<T>(window);
|
||||
const purify = createDOMPurify(window);
|
||||
|
||||
// Setting our DOMPurify config.
|
||||
purify.setConfig({
|
||||
@@ -42,7 +41,7 @@ export function createPurify<T extends boolean = true>(
|
||||
|
||||
export function sanitizeCommentBody(purify: DOMPurify, source: string) {
|
||||
// Sanitize and return the HTMLBodyElement for the parsed source.
|
||||
const sanitized = purify.sanitize(source);
|
||||
const sanitized = purify.sanitize(source, { RETURN_DOM: true });
|
||||
|
||||
// Count the total number of anchor links in the sanitized output, this is the
|
||||
// number of links.
|
||||
|
||||
Reference in New Issue
Block a user