This is a big rewrite of the remarkup rendering of diagrams. This will shift the rendering from just including the the PNG image to including drawio's static viewer script and let it handle the raw XML data of the diagram.
Benefits are: crisp and always sharp rendering in any size, standalone modal with resizing, an edit button, page selection.
So what has changed?
- I have added a parser to extract the diagram data from the saved PNG and use it to get the XML and to compare the versions when editing a diagram.
- For rendering I used the official remote https://viewer.diagrams.net/js/viewer-static.min.js because the local version wouldn't work. To get this script to load I have whitelisted https://viewer.diagrams.net as a CSP Uri in the constructor of the DiagramApplication.
- I have added/changed some remarkup options. They are now described in the new documentation.
- The rendering now adds a data-mxgraph attribute to the diagram container with all important data for the viewer script. The remarkup-image script now will
- test if there is a diagram container on the page
- if there is, it will load the viewer script
- then it will process the containers rendering the diagrams with the mxgraph data
- it will repeat this after every ajax request (so the diagrams are rendered correctly in remarkup previews)
ref T15806