Open
Description
I played around with adding a SVG transform attribute thingy
<MermaidDiagram Definition="@diagramDefinition" OnClick="OnClickNode" SvgTransform="SvgTransform" />
so that one can intercept the SVG and make modifications to it. Fairly simple.
private string SvgTransform(string svg)
{
return svg.Replace(">A<", "><font color='red'>A</font><");
}
And in the interop file
window.mermaid.mermaidAPI.render(`${componentId}-svg`, definition, async (svg, bind) => { // Made this async
svg = await componentRef.invokeMethodAsync("OnSvgCreated", svg); // Added this
And the component
[JSInvokable]
public async Task<string> OnSvgCreated(string svg)
{
if (SvgTransform != null)
{
svg = SvgTransform(svg);
}
return svg;
}
Are you interested in stuff like this? If you are I can clean it up and make a PR for it.
I also created a demo for Blazor Server.
I use Mermaid in a React project that I would like to port to Blazor for fun and I need to do some modifications on the SVG.
Metadata
Metadata
Assignees
Labels
No labels