1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00

Fix #1205 by using isomorphic-dompurify (#1228)

This commit is contained in:
Philipp Fischbeck 2022-05-16 01:30:33 +02:00 committed by GitHub
parent 3125730702
commit 4d3346b727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 376 additions and 15 deletions

View file

@ -1,5 +1,4 @@
// @ts-ignore DOMPurify has no types
import DOMPurify from "dompurify";
import DOMPurify from "isomorphic-dompurify";
import { useFraction } from "./use-fraction";
import { RecipeIngredient } from "~/types/api-types/recipe";
const { frac } = useFraction();
@ -8,7 +7,7 @@ function sanitizeIngredientHTML(rawHtml: string) {
return DOMPurify.sanitize(rawHtml, {
"USE_PROFILES": {html: true},
"ALLOWED_TAGS": ["b", "q", "i", "strong", "sup"]
}) as string
});
}
export function parseIngredientText(ingredient: RecipeIngredient, disableAmount: boolean, scale = 1): string {