reiji-h пре 1 година
родитељ
комит
83a0f2cfc1

+ 2 - 1
apps/app/src/components/Page/RevisionRenderer.tsx

@@ -1,6 +1,5 @@
 import React from 'react';
 
-import { parseSlideFrontmatterInMarkdown } from '@growi/presentation';
 import type { FallbackProps } from 'react-error-boundary';
 import { ErrorBoundary } from 'react-error-boundary';
 import ReactMarkdown from 'react-markdown';
@@ -12,6 +11,8 @@ import loggerFactory from '~/utils/logger';
 
 import { SlideViewer } from '../ReactMarkdownComponents/SlideViewer';
 
+import { parseSlideFrontmatterInMarkdown } from './markdown-slide-util-for-view';
+
 
 import 'katex/dist/katex.min.css';
 

+ 0 - 0
packages/presentation/src/services/parse-slide-frontmatter.ts → apps/app/src/components/Page/markdown-slide-util-for-view.ts


+ 13 - 2
apps/app/src/components/Presentation/Presentation.tsx

@@ -1,7 +1,18 @@
 import { Presentation as PresentationSubstance, type PresentationProps } from '@growi/presentation';
 
+import { parseSlideFrontmatter } from '../Page/markdown-slide-util-for-view';
+
 import '@growi/presentation/dist/style.css';
 
-export const Presentation = (props: PresentationProps): JSX.Element => {
-  return <PresentationSubstance {...props} />;
+type Props = {
+  isEnabledMarp: boolean
+} & PresentationProps;
+
+export const Presentation = (props: Props): JSX.Element => {
+  const { options, isEnabledMarp, children } = props;
+
+  const [marp] = parseSlideFrontmatter(children ?? '');
+  const hasMarpFlag = isEnabledMarp && marp;
+
+  return <PresentationSubstance options={options} hasMarpFlag={hasMarpFlag}>{children}</PresentationSubstance>;
 };