Merge branch 'master' into update

master
JFH 2021-12-25 17:10:35 -03:00
commit 33ec4bcbc8
2 changed files with 6 additions and 4 deletions

View File

@ -166,7 +166,9 @@ export const sanitizeSvg = function (node) {
// We can add specific namepaces on demand for now. // We can add specific namepaces on demand for now.
// Is there a more appropriate way to do this? // Is there a more appropriate way to do this?
if (attrName.startsWith('se:') || attrName.startsWith('oi:')|| attrName.startsWith('data-')) { if (attrName.startsWith('se:') || attrName.startsWith('oi:')|| attrName.startsWith('data-')) {
seAttrs.push([ attrName, attr.value ]); // We should bypass the namespace aswell
const seAttrNS = (attrName.startsWith('se:')) ? NS.SE : ((attrName.startsWith('oi:')) ? NS.OI : null);
seAttrs.push([ attrName, attr.value, seAttrNS ]);
} else { } else {
console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed`); console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed`);
node.removeAttributeNS(attrNsURI, attrLocalName); node.removeAttributeNS(attrNsURI, attrLocalName);
@ -190,8 +192,8 @@ export const sanitizeSvg = function (node) {
} }
} }
Object.values(seAttrs).forEach(([ att, val ]) => { Object.values(seAttrs).forEach(([ att, val, ns ]) => {
node.setAttributeNS(NS.SE, att, val); node.setAttributeNS(ns, att, val);
}); });
// for some elements that have a xlink:href, ensure the URI refers to a local element // for some elements that have a xlink:href, ensure the URI refers to a local element

View File

@ -51,7 +51,7 @@ export const clearSelectionMethod = function (noCall) {
svgCanvas.setEmptySelectedElements(); svgCanvas.setEmptySelectedElements();
if (!noCall) { if (!noCall) {
svgCanvas.call("selected", selectedElements); svgCanvas.call("selected", selectionContext_.getSelectedElements());
} }
}; };