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

sepalate file for draoio-config

kaori 3 лет назад
Родитель
Сommit
c2b52d3214
2 измененных файлов с 18 добавлено и 14 удалено
  1. 2 14
      packages/app/src/stores/modal.tsx
  2. 16 0
      packages/app/src/utils/drawio-config.ts

+ 2 - 14
packages/app/src/stores/modal.tsx

@@ -5,6 +5,7 @@ import {
   OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction, OnPutBackedFunction,
 } from '~/interfaces/ui';
 import { IUserGroupHasId } from '~/interfaces/user';
+import { dwawioConfig } from '~/utils/drawio-config';
 
 import { useStaticSWR } from './use-static-swr';
 
@@ -467,8 +468,6 @@ export const useDrawioModal = (status?: DrawioModalStatus): SWRResponse<DrawioMo
   };
 
   const receiveFromDrawio = (event, drawioMxFile: string) => {
-    const headerColor = '#334455';
-    const fontFamily = "Lato, -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif";
 
     if (event.data === 'ready') {
       event.source.postMessage(drawioMxFile, '*');
@@ -486,18 +485,7 @@ export const useDrawioModal = (status?: DrawioModalStatus): SWRResponse<DrawioMo
       //  * https://desk.draw.io/support/solutions/articles/16000058316-how-to-configure-draw-io-
       event.source.postMessage(JSON.stringify({
         action: 'configure',
-        config: {
-          css: `
-          .geMenubarContainer { background-color: ${headerColor} !important; }
-          .geMenubar { background-color: ${headerColor} !important; }
-          .geEditor { font-family: ${fontFamily} !important; }
-          html td.mxPopupMenuItem {
-            font-family: ${fontFamily} !important;
-            font-size: 8pt !important;
-          }
-          `,
-          customFonts: ['Lato', 'Charter'],
-        },
+        config: dwawioConfig,
       }), '*');
 
       return;

+ 16 - 0
packages/app/src/utils/drawio-config.ts

@@ -0,0 +1,16 @@
+
+const headerColor = '#334455';
+const fontFamily = "Lato, -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif";
+
+export const dwawioConfig = {
+  css: `
+  .geMenubarContainer { background-color: ${headerColor} !important; }
+  .geMenubar { background-color: ${headerColor} !important; }
+  .geEditor { font-family: ${fontFamily} !important; }
+  html td.mxPopupMenuItem {
+    font-family: ${fontFamily} !important;
+    font-size: 8pt !important;
+  }
+  `,
+  customFonts: ['Lato', 'Charter'],
+};