From 26c45f6d4d461b6ceccb9ce3053700c2add92d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Godefroy?= Date: Mon, 6 Dec 2021 15:31:41 +0100 Subject: [PATCH 1/2] Fix : call selectedChanged notification with empty selected elems array when clearSelectionMethod is called --- src/svgcanvas/selection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svgcanvas/selection.js b/src/svgcanvas/selection.js index 87d7a088..b19901ee 100644 --- a/src/svgcanvas/selection.js +++ b/src/svgcanvas/selection.js @@ -51,7 +51,7 @@ export const clearSelectionMethod = function (noCall) { svgCanvas.setEmptySelectedElements(); if (!noCall) { - svgCanvas.call("selected", selectedElements); + svgCanvas.call("selected", selectionContext_.getSelectedElements()); } }; From 7ca417c963a8b9464af31555db7f1ce0e06af1f8 Mon Sep 17 00:00:00 2001 From: jesus Date: Wed, 22 Dec 2021 19:58:16 +0100 Subject: [PATCH 2/2] [issue-674] Bypass the ns with the attribute for the se attributes in orther to avoid attribute duplication --- src/svgcanvas/sanitize.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/svgcanvas/sanitize.js b/src/svgcanvas/sanitize.js index b24402e1..91990732 100644 --- a/src/svgcanvas/sanitize.js +++ b/src/svgcanvas/sanitize.js @@ -166,7 +166,9 @@ export const sanitizeSvg = function (node) { // We can add specific namepaces on demand for now. // Is there a more appropriate way to do this? 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 { console.warn(`sanitizeSvg: attribute ${attrName} in element ${node.nodeName} not in whitelist is removed`); node.removeAttributeNS(attrNsURI, attrLocalName); @@ -190,8 +192,8 @@ export const sanitizeSvg = function (node) { } } - Object.values(seAttrs).forEach(([ att, val ]) => { - node.setAttributeNS(NS.SE, att, val); + Object.values(seAttrs).forEach(([ att, val, ns ]) => { + node.setAttributeNS(ns, att, val); }); // for some elements that have a xlink:href, ensure the URI refers to a local element