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

ignore incorrect rendererOptions

reiji-h 2 лет назад
Родитель
Сommit
010767a617
1 измененных файлов с 10 добавлено и 11 удалено
  1. 10 11
      packages/presentation/src/components/GrowiSlides.tsx

+ 10 - 11
packages/presentation/src/components/GrowiSlides.tsx

@@ -24,19 +24,18 @@ export const GrowiSlides = (props: Props): JSX.Element => {
     rendererOptions, isDarkMode, disableSeparationByHeader,
   } = options;
 
-  if (rendererOptions?.remarkPlugins != null) {
-    rendererOptions.remarkPlugins.push([
-      extractSections.remarkPlugin,
-      {
-        isDarkMode,
-        disableSeparationByHeader,
-      },
-    ]);
+  if (rendererOptions == null || rendererOptions.remarkPlugins == null || rendererOptions.components == null) {
+    return <></>;
   }
 
-  if (rendererOptions?.components != null) {
-    rendererOptions.components.section = presentation ? PresentationRichSlideSection : RichSlideSection;
-  }
+  rendererOptions.remarkPlugins.push([
+    extractSections.remarkPlugin,
+    {
+      isDarkMode,
+      disableSeparationByHeader,
+    },
+  ]);
+  rendererOptions.components.section = presentation ? PresentationRichSlideSection : RichSlideSection;
 
   const marpit = presentation ? presentationMarpit : slideMarpit;
   const { css } = marpit.render('');