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

Merge branch 'master' into feat/growi-ai-next

Shun Miyazawa 1 год назад
Родитель
Сommit
1ceee3833b

+ 5 - 0
.changeset/fair-worms-wait.md

@@ -0,0 +1,5 @@
+---
+'@growi/core': minor
+---
+
+Expose React instance to window via GrowiFacade

+ 2 - 1
apps/app/src/features/growi-plugin/client/components/GrowiPluginsActivator.tsx

@@ -1,4 +1,4 @@
-import { useEffect } from 'react';
+import React, { useEffect } from 'react';
 
 
 import { initializeGrowiFacade, registerGrowiFacade } from '../utils/growi-facade-utils';
 import { initializeGrowiFacade, registerGrowiFacade } from '../utils/growi-facade-utils';
 
 
@@ -24,6 +24,7 @@ async function activateAll(): Promise<void> {
         generatePreviewOptions,
         generatePreviewOptions,
       },
       },
     },
     },
+    react: React,
   });
   });
 
 
   if (!('pluginActivators' in window)) {
   if (!('pluginActivators' in window)) {

+ 0 - 4
apps/app/src/server/service/config-manager/config-definition.ts

@@ -207,7 +207,6 @@ export const CONFIG_KEYS = [
   'customize:highlightJsStyle',
   'customize:highlightJsStyle',
   'customize:highlightJsStyleBorder',
   'customize:highlightJsStyleBorder',
   'customize:theme',
   'customize:theme',
-  'customize:theme:forcedColorScheme',
   'customize:isContainerFluid',
   'customize:isContainerFluid',
   'customize:isEnabledTimeline',
   'customize:isEnabledTimeline',
   'customize:isEnabledAttachTitleHeader',
   'customize:isEnabledAttachTitleHeader',
@@ -939,9 +938,6 @@ export const CONFIG_DEFINITIONS = {
   'customize:theme': defineConfig<string>({
   'customize:theme': defineConfig<string>({
     defaultValue: 'default',
     defaultValue: 'default',
   }),
   }),
-  'customize:theme:forcedColorScheme': defineConfig<string | null>({
-    defaultValue: null,
-  }),
   'customize:isContainerFluid': defineConfig<boolean>({
   'customize:isContainerFluid': defineConfig<boolean>({
     defaultValue: false,
     defaultValue: false,
   }),
   }),

+ 1 - 1
apps/app/src/server/service/config-manager/config-loader.ts

@@ -44,7 +44,7 @@ export class ConfigLoader implements IConfigLoader<ConfigKey, ConfigValues> {
     for (const doc of docs) {
     for (const doc of docs) {
       dbConfig[doc.key as ConfigKey] = {
       dbConfig[doc.key as ConfigKey] = {
         definition: (doc.key in CONFIG_DEFINITIONS) ? CONFIG_DEFINITIONS[doc.key as ConfigKey] : undefined,
         definition: (doc.key in CONFIG_DEFINITIONS) ? CONFIG_DEFINITIONS[doc.key as ConfigKey] : undefined,
-        value: doc.value ? JSON.parse(doc.value) : null,
+        value: doc.value != null ? JSON.parse(doc.value) : null,
       };
       };
     }
     }
 
 

+ 1 - 1
apps/app/src/server/service/config-manager/config-manager.ts

@@ -81,7 +81,7 @@ export class ConfigManager implements IConfigManagerForApp, S2sMessageHandlable
     return (
     return (
       this.shouldUseEnvOnly(key)
       this.shouldUseEnvOnly(key)
         ? this.envConfig[key]?.value
         ? this.envConfig[key]?.value
-        : (this.dbConfig[key] ?? this.envConfig[key])?.value
+        : this.dbConfig[key]?.value ?? this.envConfig[key]?.value
     ) as ConfigValues[K];
     ) as ConfigValues[K];
   }
   }
 
 

+ 1 - 0
packages/core/src/interfaces/growi-facade.ts

@@ -8,4 +8,5 @@ export type GrowiFacade = {
     },
     },
     optionsMutators?: any,
     optionsMutators?: any,
   },
   },
+  react?: any,
 };
 };