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

Prepare types including window type extention

Taichi Masuyama 3 лет назад
Родитель
Сommit
2db13a4a73

+ 3 - 1
packages/app/src/interfaces/global.ts

@@ -1,5 +1,6 @@
 import EventEmitter from 'events';
 
+import GrowiRenderer from '~/services/renderer/growi-renderer';
 import Xss from '~/services/xss';
 
 import { IGraphViewer } from './graph-viewer';
@@ -10,4 +11,5 @@ export type CustomWindow = Window
                          & { xss: Xss }
                          & { interceptorManager: IInterceptorManager }
                          & { globalEmitter: EventEmitter }
-                         & { GraphViewer: IGraphViewer };
+                         & { GraphViewer: IGraphViewer }
+                         & { growiRenderer: GrowiRenderer };

+ 18 - 0
packages/app/src/interfaces/services/renderer.ts

@@ -1,6 +1,24 @@
+import { XssOptionConfig } from '~/services/xss/xssOption';
+
 export type RendererSettings = {
   isEnabledLinebreaks: boolean,
   isEnabledLinebreaksInComments: boolean,
   adminPreferredIndentSize: number,
   isIndentSizeForced: boolean,
 };
+
+export type GrowiHydratedEnv = {
+  PLANTUML_URI: string | null,
+  BLOCKDIAG_URI: string | null,
+  DRAWIO_URI: string | null,
+  HACKMD_URI: string | null,
+  MATHJAX: string | null,
+  NO_CDN: string | null,
+  GROWI_CLOUD_URI: string | null,
+  GROWI_APP_ID_FOR_GROWI_CLOUD: string | null,
+}
+
+export type GrowiRendererConfig = {
+  highlightJsStyleBorder: boolean
+  env: Pick<GrowiHydratedEnv, 'MATHJAX' | 'PLANTUML_URI' | 'BLOCKDIAG_URI'>
+} & XssOptionConfig;