I have implemented the drawio-integration project in my Blazor WebAssembly application.
https://github.com/jgraph/drawio-integration
This is how the simple helloworld sample appears:
<img onclick='DiagramEditor.editElement(this);' src="data:image/svg+xml;base64,PD94bW..._RjNBYVVocGF4NjFLUnN5VjFEcEZIQ3NRNnMxRGM0U0J3OUtBSD...IyMDIwLTAyLTE5VDEyOjQ0OjI3LjY1OVomcXVvdDsgaG9zdD0mcXVv...l RoJmd'-sbhe
https://github.com/jgraph/drawio-integration/blob/master/helloworld.html
When I execute the code like this, it runs smoothly without any console errors:
<img onclick='DiagramEditor.editElement(this);' @ref=MyImageElementReference src="@DrawIoImageDataUrl" style="cursor:pointer;">
ElementReference MyImageElementReference;
If I run the code like this everything works as well but I get a console error.
<img @onclick="TriggerClick" @ref=MyImageElementReference src="@DrawIoImageDataUrl" style="cursor:pointer;">
ElementReference MyImageElementReference;
public async Task TriggerClick()
{
await JSRuntime.InvokeVoidAsync("DiagramEditor.editElement", MyImageElementReference);
}
What might be causing the below error and what steps can I take to resolve it?
blazor.webassembly.js:1 Uncaught (in promise) TypeError: Converting circular structure to JSON --> starting at object with constructor 'HTMLImageElement' | property '_blazorEvents_1' -> object with constructor 'e' | property 'handlers' -> object with constructor 'Object' | property 'click' -> object with constructor 'Object' --- property 'element' closes the circle at JSON.stringify () at blazor.webassembly.js:1