|
@@ -1,11 +1,11 @@
|
|
|
import React, {
|
|
import React, {
|
|
|
- useCallback,
|
|
|
|
|
|
|
+ FC, useCallback,
|
|
|
useEffect, useRef,
|
|
useEffect, useRef,
|
|
|
} from 'react';
|
|
} from 'react';
|
|
|
|
|
|
|
|
import EventEmitter from 'events';
|
|
import EventEmitter from 'events';
|
|
|
|
|
|
|
|
-import { pagePathUtils } from '@growi/core';
|
|
|
|
|
|
|
+import { pagePathUtils, IPagePopulatedToShowRevision } from '@growi/core';
|
|
|
import { DrawioEditByViewerProps } from '@growi/remark-drawio';
|
|
import { DrawioEditByViewerProps } from '@growi/remark-drawio';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
import { useTranslation } from 'next-i18next';
|
|
|
import dynamic from 'next/dynamic';
|
|
import dynamic from 'next/dynamic';
|
|
@@ -48,9 +48,13 @@ const LinkEditModal = dynamic(() => import('./PageEditor/LinkEditModal'), { ssr:
|
|
|
|
|
|
|
|
const logger = loggerFactory('growi:Page');
|
|
const logger = loggerFactory('growi:Page');
|
|
|
|
|
|
|
|
|
|
+type Props = {
|
|
|
|
|
+ currentPage?: IPagePopulatedToShowRevision,
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-export const Page = (props) => {
|
|
|
|
|
|
|
+export const Page: FC<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
+ const { currentPage } = props;
|
|
|
|
|
|
|
|
// Pass tocRef to generateViewOptions (=> rehypePlugin => customizeTOC) to call mutateCurrentPageTocNode when tocRef.current changes.
|
|
// Pass tocRef to generateViewOptions (=> rehypePlugin => customizeTOC) to call mutateCurrentPageTocNode when tocRef.current changes.
|
|
|
// The toc node passed by customizeTOC is assigned to tocRef.current.
|
|
// The toc node passed by customizeTOC is assigned to tocRef.current.
|
|
@@ -64,7 +68,7 @@ export const Page = (props) => {
|
|
|
const isSharedPage = pagePathUtils.isSharedPage(currentPathname ?? '');
|
|
const isSharedPage = pagePathUtils.isSharedPage(currentPathname ?? '');
|
|
|
|
|
|
|
|
const { data: shareLinkId } = useShareLinkId();
|
|
const { data: shareLinkId } = useShareLinkId();
|
|
|
- const { data: currentPage, mutate: mutateCurrentPage } = useSWRxCurrentPage();
|
|
|
|
|
|
|
+ const { mutate: mutateCurrentPage } = useSWRxCurrentPage();
|
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
|
const { data: tagsInfo } = useSWRxTagsInfo(!isSharedPage ? currentPage?._id : undefined);
|
|
const { data: tagsInfo } = useSWRxTagsInfo(!isSharedPage ? currentPage?._id : undefined);
|
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
const { data: isGuestUser } = useIsGuestUser();
|