From c2a9798bfe17db52c58883030a50524e76ca0e94 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Thu, 21 Feb 2019 19:24:22 +0800 Subject: [PATCH] - Enhancement: Whitelist `feMorphology` element - Todo --- editor/sanitize.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/sanitize.js b/editor/sanitize.js index d866d779..fe970280 100644 --- a/editor/sanitize.js +++ b/editor/sanitize.js @@ -12,7 +12,12 @@ import {getHref, setHref, getUrlFromAttr} from './utilities.js'; const REVERSE_NS = getReverseNS(); -// this defines which elements and attributes that we support +// Todo: Split out into core attributes, presentation attributes, etc. so consistent +/** + * This defines which elements and attributes that we support (or at least + * don't remove) + * @type {PlainObject} + */ const svgWhiteList_ = { // SVG Elements a: ['class', 'clip-path', 'clip-rule', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'id', 'mask', 'opacity', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform', 'xlink:href', 'xlink:title'], @@ -23,6 +28,7 @@ const svgWhiteList_ = { desc: [], ellipse: ['class', 'clip-path', 'clip-rule', 'cx', 'cy', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'id', 'mask', 'opacity', 'requiredFeatures', 'rx', 'ry', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform'], feGaussianBlur: ['class', 'color-interpolation-filters', 'id', 'requiredFeatures', 'stdDeviation'], + feMorphology: ['class', 'in', 'operator', 'radius'], filter: ['class', 'color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'id', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'], foreignObject: ['class', 'font-size', 'height', 'id', 'opacity', 'requiredFeatures', 'style', 'transform', 'width', 'x', 'y'], g: ['class', 'clip-path', 'clip-rule', 'id', 'display', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-anchor'],