|
|
@@ -1,10 +1,32 @@
|
|
|
<!-- draw.io -->
|
|
|
+{% if local_config.env.DRAWIO_URI %}
|
|
|
<script type="text/javascript">
|
|
|
// refs: https://github.com/jgraph/drawio/blob/v13.4.3/etc/build/build.xml#L35-L38
|
|
|
let url = new URL("{{ local_config.env.DRAWIO_URI }}");
|
|
|
let origin = url.origin;
|
|
|
window.DRAWIO_BASE_URL = origin;
|
|
|
+ window.DRAWIO_LIGHTBOX_URL = origin;
|
|
|
+ // window.urlParams = { 'lightbox' : '1' }
|
|
|
window.STENCIL_PATH = [origin, 'stencils'].join('/');
|
|
|
window.SHAPES_PATH = [origin, 'shapes'].join('/');
|
|
|
window.mxBasePath = [origin, 'mxgraph'].join('/');
|
|
|
</script>
|
|
|
+{% endif %}
|
|
|
+
|
|
|
+<script type="text/javascript">
|
|
|
+ // define callback function invoked by viewer.min.js of draw.io
|
|
|
+ // refs: https://github.com/jgraph/drawio/blob/v12.9.1/etc/build/build.xml#L219-L232
|
|
|
+ window.onDrawioViewerLoad = function() {
|
|
|
+ const DrawioViewer = window.GraphViewer;
|
|
|
+
|
|
|
+ if (DrawioViewer != null) {
|
|
|
+ // disable useResizeSensor and checkVisibleState
|
|
|
+ // for preventing resize event by viewer.min.js
|
|
|
+ DrawioViewer.useResizeSensor = false;
|
|
|
+ DrawioViewer.prototype.checkVisibleState = false;
|
|
|
+
|
|
|
+ // initialize
|
|
|
+ DrawioViewer.processElements();
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|