feat(https): use https in SVGs

This commit is contained in:
Daniel Thompson-Yvetot
2019-09-19 20:53:42 +02:00
parent e40e1da292
commit f30f607b0c
5 changed files with 17 additions and 17 deletions

View File

@@ -83,13 +83,13 @@ export const addVertices = function(vert, g, svgId) {
vertexNode = addHtmlLabel(svg, node).node(); vertexNode = addHtmlLabel(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode); vertexNode.parentNode.removeChild(vertexNode);
} else { } else {
const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text'); const svgLabel = document.createElementNS('https://www.w3.org/2000/svg', 'text');
const rows = vertexText.split(/<br[/]{0,1}>/); const rows = vertexText.split(/<br[/]{0,1}>/);
for (let j = 0; j < rows.length; j++) { for (let j = 0; j < rows.length; j++) {
const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan'); const tspan = document.createElementNS('https://www.w3.org/2000/svg', 'tspan');
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); tspan.setAttributeNS('https://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
tspan.setAttribute('dy', '1em'); tspan.setAttribute('dy', '1em');
tspan.setAttribute('x', '1'); tspan.setAttribute('x', '1');
tspan.textContent = rows[j]; tspan.textContent = rows[j];
@@ -100,9 +100,9 @@ export const addVertices = function(vert, g, svgId) {
// If the node has a link, we wrap it in a SVG link // If the node has a link, we wrap it in a SVG link
if (vertex.link) { if (vertex.link) {
const link = document.createElementNS('http://www.w3.org/2000/svg', 'a'); const link = document.createElementNS('https://www.w3.org/2000/svg', 'a');
link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link); link.setAttributeNS('https://www.w3.org/2000/svg', 'href', vertex.link);
link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener'); link.setAttributeNS('https://www.w3.org/2000/svg', 'rel', 'noopener');
link.appendChild(vertexNode); link.appendChild(vertexNode);
vertexNode = link; vertexNode = link;
} }
@@ -609,7 +609,7 @@ export const draw = function(text, id) {
// Get dimensions of label // Get dimensions of label
const dim = label.getBBox(); const dim = label.getBBox();
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); const rect = document.createElementNS('https://www.w3.org/2000/svg', 'rect');
rect.setAttribute('rx', 0); rect.setAttribute('rx', 0);
rect.setAttribute('ry', 0); rect.setAttribute('ry', 0);
rect.setAttribute('width', dim.width); rect.setAttribute('width', dim.width);

View File

@@ -48,7 +48,7 @@ function svgCreateDefs(svg) {
.attr('x', config.nodeLabel.x) .attr('x', config.nodeLabel.x)
.attr('y', config.nodeLabel.y) .attr('y', config.nodeLabel.y)
.attr('class', 'node-label') .attr('class', 'node-label')
.attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility') .attr('requiredFeatures', 'https://www.w3.org/TR/SVG11/feature#Extensibility')
.append('p') .append('p')
.html(''); .html('');
} }

View File

@@ -1,5 +1,5 @@
/** mermaid /** mermaid
* http://knsv.github.io/mermaid/ * https://knsv.github.io/mermaid
* (c) 2015 Knut Sveidqvist * (c) 2015 Knut Sveidqvist
* MIT license. * MIT license.
*/ */

View File

@@ -1,5 +1,5 @@
/** mermaid /** mermaid
* http://knsv.github.io/mermaid/ * https://knsv.github.io/mermaid
* (c) 2015 Knut Sveidqvist * (c) 2015 Knut Sveidqvist
* MIT license. * MIT license.
*/ */

View File

@@ -426,7 +426,7 @@ const render = function(id, txt, cb, container) {
.append('svg') .append('svg')
.attr('id', id) .attr('id', id)
.attr('width', '100%') .attr('width', '100%')
.attr('xmlns', 'http://www.w3.org/2000/svg') .attr('xmlns', 'https://www.w3.org/2000/svg')
.append('g'); .append('g');
} else { } else {
const element = document.querySelector('#' + 'd' + id); const element = document.querySelector('#' + 'd' + id);
@@ -440,7 +440,7 @@ const render = function(id, txt, cb, container) {
.append('svg') .append('svg')
.attr('id', id) .attr('id', id)
.attr('width', '100%') .attr('width', '100%')
.attr('xmlns', 'http://www.w3.org/2000/svg') .attr('xmlns', 'https://www.w3.org/2000/svg')
.append('g'); .append('g');
} }
@@ -535,7 +535,7 @@ const render = function(id, txt, cb, container) {
d3.select(`[id="${id}"]`) d3.select(`[id="${id}"]`)
.selectAll('foreignobject > *') .selectAll('foreignobject > *')
.attr('xmlns', 'http://www.w3.org/1999/xhtml'); .attr('xmlns', 'https://www.w3.org/1999/xhtml');
let url = ''; let url = '';
if (config.arrowMarkerAbsolute) { if (config.arrowMarkerAbsolute) {