fix: TOUTES les clés i18n manquantes ajoutées — 0 erreur
- general.continue/send - structuredViews.tagApplied/filterDone/filterTodo/propertyStatus - wizard.taskA/taskB - richTextEditor.preview*Tip (7 clés SlashPreview) - wizard.* au niveau racine (48 clés FR + 48 EN) - Total: 0 clé manquante pour FR et EN - 0 erreur TypeScript
This commit is contained in:
29
memento-note/lib/sanitize-content.ts
Normal file
29
memento-note/lib/sanitize-content.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import DOMPurify from 'isomorphic-dompurify'
|
||||
|
||||
const SVG_SANITIZE_CONFIG = {
|
||||
USE_PROFILES: { svg: true, svgFilters: true },
|
||||
ADD_TAGS: [
|
||||
'use', 'defs', 'linearGradient', 'radialGradient', 'stop',
|
||||
'filter', 'feDropShadow', 'feGaussianBlur', 'feBlend', 'feComposite',
|
||||
'feMerge', 'feMergeNode', 'feColorMatrix', 'feOffset', 'feTurbulence',
|
||||
'feDisplacementMap', 'clipPath', 'mask', 'pattern', 'symbol', 'marker',
|
||||
],
|
||||
ADD_ATTR: [
|
||||
'viewBox', 'xmlns', 'preserveAspectRatio',
|
||||
'gradientUnits', 'gradientTransform', 'spreadMethod',
|
||||
'offset', 'stop-color', 'stop-opacity',
|
||||
'x', 'y', 'width', 'height', 'fill', 'stroke', 'stroke-width',
|
||||
'opacity', 'transform', 'd', 'cx', 'cy', 'r', 'rx', 'ry',
|
||||
'x1', 'y1', 'x2', 'y2', 'points', 'class', 'id', 'href', 'xlink:href',
|
||||
],
|
||||
} as const
|
||||
|
||||
export function sanitizeIllustrationSvg(svg: string): string {
|
||||
if (!svg) return ''
|
||||
return DOMPurify.sanitize(svg, SVG_SANITIZE_CONFIG)
|
||||
}
|
||||
|
||||
export function sanitizeRichHtml(html: string): string {
|
||||
if (!html) return ''
|
||||
return DOMPurify.sanitize(html, { USE_PROFILES: { html: true } })
|
||||
}
|
||||
Reference in New Issue
Block a user