You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ad1992, I use the mermaid object that comes with Obsidian. Obsidian upgraded to 10.6.1 which broke the sequence diagram parsing logic.
I am sharing my solution here, so when you eventually upgrade mermaid-to-excalidraw to mermaid 10.6.1 you don't need to go through the same debugging.
Look for the lines with //zsviczian
Essentially the sequence of elements changed in the SVG file and lineNode = topRootNode.previousElementSibling as SVGLineElement; returns null. Also the logic for avoiding the overlapping vertical line changed...
I hope you find this helpful.
constparseActor=(actors: {[key: string]: Actor},containerEl: Element)=>{constactorRootNodes=Array.from(containerEl.querySelectorAll(".actor")).filter((node)=>node.tagName==="text").map((actor)=>actor.tagName==="text"&&actor.parentElement);constlineNodes=containerEl.querySelectorAll("line");//zsviczianconstnodes: Array<Node[]>=[];constlines: Array<Line>=[];constactorsLength=Object.keys(actors).length;Object.values(actors).forEach((actor,index)=>{//@ts-ignore// For each actor there are two nodes top and bottom which is connected by a lineconsttopRootNode=actorRootNodes[index]asSVGGElement;//@ts-ignoreconstbottomRootNode=actorRootNodes[actorsLength+index]asSVGGElement;if(!topRootNode){throw"root not found";}consttext=actor.description;if(actor.type==="participant"){// creating top actor node elementconsttopNodeElement=createContainerElement(topRootNode.firstChildasSVGSVGElement,"rectangle",{id: `${actor.name}-top`, text,subtype: "actor"});if(!topNodeElement){throw"Top Node element not found!";}nodes.push([topNodeElement]);// creating bottom actor node elementconstbottomNodeElement=createContainerElement(bottomRootNode.firstChildasSVGSVGElement,"rectangle",{id: `${actor.name}-bottom`, text,subtype: "actor"});nodes.push([bottomNodeElement]);// Get the line connecting the top and bottom nodes. As per the DOM, the line is rendered as first child of parent elementconstlineNode=lineNodes[index];//zsviczianif(lineNode?.tagName!=="line"){throw"Line not found";}conststartX=Number(lineNode.getAttribute("x1"));if(!bottomNodeElement.height){//zsviczianthrow"Bottom node element height is null";}conststartY=topNodeElement.y;//zsviczian// Make sure lines don't overlap with the nodes, in mermaid it overlaps but isn't visible as its pushed back and containers are non transparentconstendY=bottomNodeElement.y+bottomNodeElement.height;//zsviczianconstendX=Number(lineNode.getAttribute("x2"));constline=createLineElement(lineNode,startX,startY,endX,endY);lines.push(line);}elseif(actor.type==="actor"){consttopNodeElement=createActorSymbol(topRootNode,text,{id: `${actor.name}-top`,});nodes.push(topNodeElement);constbottomNodeElement=createActorSymbol(bottomRootNode,text,{id: `${actor.name}-bottom`,});nodes.push(bottomNodeElement);// Get the line connecting the top and bottom nodes. As per the DOM, the line is rendered as first child of parent elementconstlineNode=lineNodes[index];//zsviczianif(lineNode?.tagName!=="line"){throw"Line not found";}conststartX=Number(lineNode.getAttribute("x1"));conststartY=Number(lineNode.getAttribute("y1"));constendX=Number(lineNode.getAttribute("x2"));// Make sure lines don't overlap with the nodes, in mermaid it overlaps but isn't visible as its pushed back and containers are non transparentconstbottomEllipseNode=bottomNodeElement.find((node): node is Container=>node.type==="ellipse");if(bottomEllipseNode){constendY=bottomEllipseNode.y;constline=createLineElement(lineNode,startX,startY,endX,endY);lines.push(line);}}});
The text was updated successfully, but these errors were encountered:
Hi @zsviczian 👋🏻 just back from time off, yes the sequence diagrams ordering was updated, I had already fixed the issue in mermaid js here and now it works absolutely fine, however, I am waiting for them to ship the next release, so I will either release it from fork if needed (in case the official release is delayed). So the above patch won't be needed.
@ad1992, I use the mermaid object that comes with Obsidian. Obsidian upgraded to 10.6.1 which broke the sequence diagram parsing logic.
I am sharing my solution here, so when you eventually upgrade mermaid-to-excalidraw to mermaid 10.6.1 you don't need to go through the same debugging.
Look for the lines with //zsviczian
Essentially the sequence of elements changed in the SVG file and
lineNode = topRootNode.previousElementSibling as SVGLineElement;
returns null. Also the logic for avoiding the overlapping vertical line changed...I hope you find this helpful.
The text was updated successfully, but these errors were encountered: