From 1b50e1e9d504170e0820ef8540e3dbca3d964d37 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 27 Aug 2024 14:29:14 +0200 Subject: [PATCH] Fix some CSP violations --- src/core/creation.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/creation.ts b/src/core/creation.ts index f35836c8..d24fbbe3 100644 --- a/src/core/creation.ts +++ b/src/core/creation.ts @@ -38,15 +38,15 @@ export function createSvg( .forEach(svg => container.removeChild(svg)); // Create svg object with width and height or use 100% as default - const svg = new Svg('svg') - .attr({ - width, - height - }) - .attr({ - // TODO: Check better solution (browser support) and remove inline styles due to CSP - style: `width: ${width}; height: ${height};` - }); + const svg = new Svg('svg').attr({ + width, + height + }); + + // TODO: Check better solution (browser support) + const svgNode = svg.getNode(); + svgNode.style.width = width; + svgNode.style.height = height; if (className) { svg.addClass(className); @@ -261,9 +261,9 @@ export function createLabel( content.textContent = String(label); const labelElement = group.foreignObject(content, { - style: 'overflow: visible;', ...positionalData }); + (labelElement.getNode()).style.overflow = 'visible'; eventEmitter.emit('draw', { type: 'label',