Просмотр исходного кода

Fix #2561

* set window.DRAWIO_LIGHTBOX_URL
Koki Oyatsu 5 лет назад
Родитель
Сommit
fc7e808cdf

+ 0 - 16
src/client/js/util/interceptor/drawio-interceptor.js

@@ -18,22 +18,6 @@ export class DrawioInterceptor extends BasicInterceptor {
 
     this.previousPreviewContext = null;
     this.appContainer = appContainer;
-
-    // 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();
-      }
-    };
   }
 
   /**

+ 1 - 3
src/server/views/layout/layout.html

@@ -23,9 +23,7 @@
     {% include '../widget/headers/mathjax.html' %}
   {% endif %}
 
-  {% if local_config.env.DRAWIO_URI %}
-    {% include '../widget/headers/drawio.html' %}
-  {% endif %}
+  {% include '../widget/headers/drawio.html' %}
 
   {% include '../widget/headers/scripts-for-dev.html' %}
 

+ 22 - 0
src/server/views/widget/headers/drawio.html

@@ -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>