#1212 Class definition is not applied to flowchart nodes with links

This commit is contained in:
Marc Faber
2020-01-19 18:10:14 +01:00
parent 921d274579
commit c38f053294
3 changed files with 17 additions and 11 deletions

View File

@@ -374,6 +374,7 @@ describe('Flowchart', () => {
click B testClick "click test" click B testClick "click test"
classDef someclass fill:#f96; classDef someclass fill:#f96;
class A someclass; class A someclass;
class C someclass;
`, `,
{ {
listUrl: false, listUrl: false,
@@ -409,7 +410,9 @@ describe('Flowchart', () => {
click A "index.html#link-clicked" "link test" click A "index.html#link-clicked" "link test"
click B testClick "click test" click B testClick "click test"
classDef someclass fill:#f96; classDef someclass fill:#f96;
class A someclass;`, class A someclass;
class C someclass;
`,
{ flowchart: { htmlLabels: false } } { flowchart: { htmlLabels: false } }
); );
}); });

2
dist/index.html vendored
View File

@@ -299,6 +299,7 @@ click A "index.html#link-clicked" "link test"
click B testClick "click test" click B testClick "click test"
classDef someclass fill:#f96; classDef someclass fill:#f96;
class A someclass; class A someclass;
class C someclass;
</div> </div>
<div class="mermaid"> <div class="mermaid">
graph TD graph TD
@@ -312,6 +313,7 @@ class A someclass;
click B testClick "click test" click B testClick "click test"
classDef someclass fill:#f96; classDef someclass fill:#f96;
class A someclass; class A someclass;
class C someclass;
</div> </div>
<div class="mermaid"> <div class="mermaid">
graph LR graph LR

View File

@@ -461,6 +461,7 @@ export const draw = function(text, id) {
const node = d3.select('#' + id + ' [id="' + key + '"]'); const node = d3.select('#' + id + ' [id="' + key + '"]');
if (node) { if (node) {
const link = document.createElementNS('http://www.w3.org/2000/svg', 'a'); const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link); link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener'); link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');