|
|
@@ -1,32 +1,42 @@
|
|
|
-import React, {
|
|
|
- useState, useCallback, useMemo, type JSX,
|
|
|
-} from 'react';
|
|
|
-
|
|
|
-
|
|
|
-import { isPopulated } from '@growi/core';
|
|
|
+import React, { type JSX, useCallback, useMemo, useState } from 'react';
|
|
|
+import dynamic from 'next/dynamic';
|
|
|
+import Link from 'next/link';
|
|
|
+import { useRouter } from 'next/router';
|
|
|
import type {
|
|
|
+ IPageInfoForEntity,
|
|
|
IPagePopulatedToShowRevision,
|
|
|
- IPageToRenameWithMeta, IPageWithMeta, IPageInfoForEntity,
|
|
|
+ IPageToRenameWithMeta,
|
|
|
+ IPageWithMeta,
|
|
|
} from '@growi/core';
|
|
|
+import { isPopulated } from '@growi/core';
|
|
|
import { pagePathUtils } from '@growi/core/dist/utils';
|
|
|
import { GlobalCodeMirrorEditorKey } from '@growi/editor';
|
|
|
import { useCodeMirrorEditorIsolated } from '@growi/editor/dist/client/stores/codemirror-editor';
|
|
|
import { useAtomValue } from 'jotai';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
-import dynamic from 'next/dynamic';
|
|
|
-import Link from 'next/link';
|
|
|
-import { useRouter } from 'next/router';
|
|
|
import Sticky from 'react-stickynode';
|
|
|
-import { DropdownItem, UncontrolledTooltip, Tooltip } from 'reactstrap';
|
|
|
+import { DropdownItem, Tooltip, UncontrolledTooltip } from 'reactstrap';
|
|
|
|
|
|
-import { exportAsMarkdown, updateContentWidth, syncLatestRevisionBody } from '~/client/services/page-operation';
|
|
|
+import {
|
|
|
+ exportAsMarkdown,
|
|
|
+ syncLatestRevisionBody,
|
|
|
+ updateContentWidth,
|
|
|
+} from '~/client/services/page-operation';
|
|
|
import { usePrintMode } from '~/client/services/use-print-mode';
|
|
|
-import { toastSuccess, toastError, toastWarning } from '~/client/util/toastr';
|
|
|
+import { toastError, toastSuccess, toastWarning } from '~/client/util/toastr';
|
|
|
import { GroundGlassBar } from '~/components/Navbar/GroundGlassBar';
|
|
|
import { usePageBulkExportSelectModalActions } from '~/features/page-bulk-export/client/states/modal';
|
|
|
-import type { OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction } from '~/interfaces/ui';
|
|
|
+import type {
|
|
|
+ OnDeletedFunction,
|
|
|
+ OnDuplicatedFunction,
|
|
|
+ OnRenamedFunction,
|
|
|
+} from '~/interfaces/ui';
|
|
|
import { useShouldExpandContent } from '~/services/layout/use-should-expand-content';
|
|
|
-import { useIsGuestUser, useIsReadOnlyUser, useIsSharedUser } from '~/states/context';
|
|
|
+import {
|
|
|
+ useIsGuestUser,
|
|
|
+ useIsReadOnlyUser,
|
|
|
+ useIsSharedUser,
|
|
|
+} from '~/states/context';
|
|
|
import { useCurrentPathname, useCurrentUser } from '~/states/global';
|
|
|
import { useCurrentPageId, useFetchCurrentPage } from '~/states/page';
|
|
|
import { useShareLinkId } from '~/states/page/hooks';
|
|
|
@@ -38,18 +48,22 @@ import {
|
|
|
} from '~/states/server-configurations';
|
|
|
import { useDeviceLargerThanMd } from '~/states/ui/device';
|
|
|
import { useEditorMode } from '~/states/ui/editor';
|
|
|
-import { PageAccessoriesModalContents, usePageAccessoriesModalActions } from '~/states/ui/modal/page-accessories';
|
|
|
+import {
|
|
|
+ PageAccessoriesModalContents,
|
|
|
+ usePageAccessoriesModalActions,
|
|
|
+} from '~/states/ui/modal/page-accessories';
|
|
|
import { usePageDeleteModalActions } from '~/states/ui/modal/page-delete';
|
|
|
-import { usePageDuplicateModalActions, type IPageForPageDuplicateModal } from '~/states/ui/modal/page-duplicate';
|
|
|
+import {
|
|
|
+ type IPageForPageDuplicateModal,
|
|
|
+ usePageDuplicateModalActions,
|
|
|
+} from '~/states/ui/modal/page-duplicate';
|
|
|
import { usePresentationModalActions } from '~/states/ui/modal/page-presentation';
|
|
|
import { usePageRenameModalActions } from '~/states/ui/modal/page-rename';
|
|
|
import {
|
|
|
- useIsAbleToShowPageManagement,
|
|
|
useIsAbleToChangeEditorMode,
|
|
|
+ useIsAbleToShowPageManagement,
|
|
|
} from '~/states/ui/page-abilities';
|
|
|
-import {
|
|
|
- useSWRxPageInfo,
|
|
|
-} from '~/stores/page';
|
|
|
+import { useSWRxPageInfo } from '~/stores/page';
|
|
|
import { mutatePageTree, mutateRecentlyUpdated } from '~/stores/page-listing';
|
|
|
|
|
|
import { CreateTemplateModalLazyLoaded } from '../CreateTemplateModal';
|
|
|
@@ -59,29 +73,35 @@ import { Skeleton } from '../Skeleton';
|
|
|
import styles from './GrowiContextualSubNavigation.module.scss';
|
|
|
import PageEditorModeManagerStyles from './PageEditorModeManager.module.scss';
|
|
|
|
|
|
-
|
|
|
const PageEditorModeManager = dynamic(
|
|
|
- () => import('./PageEditorModeManager').then(mod => mod.PageEditorModeManager),
|
|
|
- { ssr: false, loading: () => <Skeleton additionalClass={`${PageEditorModeManagerStyles['grw-page-editor-mode-manager-skeleton']}`} /> },
|
|
|
+ () =>
|
|
|
+ import('./PageEditorModeManager').then((mod) => mod.PageEditorModeManager),
|
|
|
+ {
|
|
|
+ ssr: false,
|
|
|
+ loading: () => (
|
|
|
+ <Skeleton
|
|
|
+ additionalClass={`${PageEditorModeManagerStyles['grw-page-editor-mode-manager-skeleton']}`}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ },
|
|
|
);
|
|
|
const PageControls = dynamic(
|
|
|
- () => import('../PageControls').then(mod => mod.PageControls),
|
|
|
+ () => import('../PageControls').then((mod) => mod.PageControls),
|
|
|
{ ssr: false, loading: () => <></> },
|
|
|
);
|
|
|
|
|
|
-
|
|
|
type PageOperationMenuItemsProps = {
|
|
|
- pageId: string,
|
|
|
- revisionId: string,
|
|
|
- isLinkSharingDisabled?: boolean,
|
|
|
-}
|
|
|
+ pageId: string;
|
|
|
+ revisionId: string;
|
|
|
+ isLinkSharingDisabled?: boolean;
|
|
|
+};
|
|
|
|
|
|
-const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element => {
|
|
|
+const PageOperationMenuItems = (
|
|
|
+ props: PageOperationMenuItemsProps,
|
|
|
+): JSX.Element => {
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
- const {
|
|
|
- pageId, revisionId, isLinkSharingDisabled,
|
|
|
- } = props;
|
|
|
+ const { pageId, revisionId, isLinkSharingDisabled } = props;
|
|
|
|
|
|
const isGuestUser = useIsGuestUser();
|
|
|
const isReadOnlyUser = useIsReadOnlyUser();
|
|
|
@@ -91,9 +111,12 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
|
|
|
const { open: openPresentationModal } = usePresentationModalActions();
|
|
|
const { open: openAccessoriesModal } = usePageAccessoriesModalActions();
|
|
|
- const { open: openPageBulkExportSelectModal } = usePageBulkExportSelectModalActions();
|
|
|
+ const { open: openPageBulkExportSelectModal } =
|
|
|
+ usePageBulkExportSelectModalActions();
|
|
|
|
|
|
- const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(GlobalCodeMirrorEditorKey.MAIN);
|
|
|
+ const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(
|
|
|
+ GlobalCodeMirrorEditorKey.MAIN,
|
|
|
+ );
|
|
|
|
|
|
const [isBulkExportTooltipOpen, setIsBulkExportTooltipOpen] = useState(false);
|
|
|
|
|
|
@@ -117,8 +140,7 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
}
|
|
|
|
|
|
toastSuccess(t('sync-latest-revision-body.success-toaster'));
|
|
|
- }
|
|
|
- catch {
|
|
|
+ } catch {
|
|
|
toastError(t('sync-latest-revision-body.error-toaster'));
|
|
|
}
|
|
|
}
|
|
|
@@ -130,7 +152,9 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
onClick={() => syncLatestRevisionBodyHandler()}
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">sync</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ sync
|
|
|
+ </span>
|
|
|
{t('sync-latest-revision-body.menuitem')}
|
|
|
</DropdownItem>
|
|
|
|
|
|
@@ -140,7 +164,9 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
data-testid="open-presentation-modal-btn"
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">jamboard_kiosk</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ jamboard_kiosk
|
|
|
+ </span>
|
|
|
{t('Presentation Mode')}
|
|
|
</DropdownItem>
|
|
|
|
|
|
@@ -149,7 +175,9 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
onClick={() => exportAsMarkdown(pageId, revisionId, 'md')}
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">cloud_download</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ cloud_download
|
|
|
+ </span>
|
|
|
{t('page_export.export_page_markdown')}
|
|
|
</DropdownItem>
|
|
|
|
|
|
@@ -162,7 +190,9 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
disabled={!isUploadEnabled ?? true}
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">cloud_download</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ cloud_download
|
|
|
+ </span>
|
|
|
{t('page_export.bulk_export')}
|
|
|
</DropdownItem>
|
|
|
</span>
|
|
|
@@ -185,32 +215,47 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
refs: PageAccessoriesModalControl
|
|
|
*/}
|
|
|
<DropdownItem
|
|
|
- onClick={() => openAccessoriesModal(PageAccessoriesModalContents.PageHistory)}
|
|
|
+ onClick={() =>
|
|
|
+ openAccessoriesModal(PageAccessoriesModalContents.PageHistory)
|
|
|
+ }
|
|
|
disabled={!!isGuestUser || !!isSharedUser}
|
|
|
data-testid="open-page-accessories-modal-btn-with-history-tab"
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">history</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ history
|
|
|
+ </span>
|
|
|
{t('History')}
|
|
|
</DropdownItem>
|
|
|
|
|
|
<DropdownItem
|
|
|
- onClick={() => openAccessoriesModal(PageAccessoriesModalContents.Attachment)}
|
|
|
+ onClick={() =>
|
|
|
+ openAccessoriesModal(PageAccessoriesModalContents.Attachment)
|
|
|
+ }
|
|
|
data-testid="open-page-accessories-modal-btn-with-attachment-data-tab"
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">attachment</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ attachment
|
|
|
+ </span>
|
|
|
{t('attachment_data')}
|
|
|
</DropdownItem>
|
|
|
|
|
|
{!isGuestUser && !isReadOnlyUser && !isSharedUser && (
|
|
|
- <NotAvailable isDisabled={isLinkSharingDisabled ?? false} title="Disabled by admin">
|
|
|
+ <NotAvailable
|
|
|
+ isDisabled={isLinkSharingDisabled ?? false}
|
|
|
+ title="Disabled by admin"
|
|
|
+ >
|
|
|
<DropdownItem
|
|
|
- onClick={() => openAccessoriesModal(PageAccessoriesModalContents.ShareLink)}
|
|
|
+ onClick={() =>
|
|
|
+ openAccessoriesModal(PageAccessoriesModalContents.ShareLink)
|
|
|
+ }
|
|
|
data-testid="open-page-accessories-modal-btn-with-share-link-management-data-tab"
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">share</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ share
|
|
|
+ </span>
|
|
|
{t('share_links.share_link_management')}
|
|
|
</DropdownItem>
|
|
|
</NotAvailable>
|
|
|
@@ -220,10 +265,12 @@ const PageOperationMenuItems = (props: PageOperationMenuItemsProps): JSX.Element
|
|
|
};
|
|
|
|
|
|
type CreateTemplateMenuItemsProps = {
|
|
|
- onClickTemplateMenuItem: (isPageTemplateModalShown: boolean) => void,
|
|
|
-}
|
|
|
+ onClickTemplateMenuItem: (isPageTemplateModalShown: boolean) => void;
|
|
|
+};
|
|
|
|
|
|
-const CreateTemplateMenuItems = (props: CreateTemplateMenuItemsProps): JSX.Element => {
|
|
|
+const CreateTemplateMenuItems = (
|
|
|
+ props: CreateTemplateMenuItemsProps,
|
|
|
+): JSX.Element => {
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
const { onClickTemplateMenuItem } = props;
|
|
|
@@ -240,7 +287,9 @@ const CreateTemplateMenuItems = (props: CreateTemplateMenuItemsProps): JSX.Eleme
|
|
|
className="grw-page-control-dropdown-item"
|
|
|
data-testid="open-page-template-modal-btn"
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">contract_edit</span>
|
|
|
+ <span className="material-symbols-outlined me-1 grw-page-control-dropdown-icon">
|
|
|
+ contract_edit
|
|
|
+ </span>
|
|
|
{t('template.option_label.create/edit')}
|
|
|
</DropdownItem>
|
|
|
</>
|
|
|
@@ -248,11 +297,12 @@ const CreateTemplateMenuItems = (props: CreateTemplateMenuItemsProps): JSX.Eleme
|
|
|
};
|
|
|
|
|
|
type GrowiContextualSubNavigationProps = {
|
|
|
- currentPage?: IPagePopulatedToShowRevision | null,
|
|
|
+ currentPage?: IPagePopulatedToShowRevision | null;
|
|
|
};
|
|
|
|
|
|
-const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps): JSX.Element => {
|
|
|
-
|
|
|
+const GrowiContextualSubNavigation = (
|
|
|
+ props: GrowiContextualSubNavigationProps,
|
|
|
+): JSX.Element => {
|
|
|
const { currentPage } = props;
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
@@ -267,14 +317,17 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
const isSharedPage = pagePathUtils.isSharedPage(currentPathname ?? '');
|
|
|
|
|
|
const revision = currentPage?.revision;
|
|
|
- const revisionId = (revision != null && isPopulated(revision)) ? revision._id : undefined;
|
|
|
+ const revisionId =
|
|
|
+ revision != null && isPopulated(revision) ? revision._id : undefined;
|
|
|
|
|
|
const { editorMode } = useEditorMode();
|
|
|
const pageId = useCurrentPageId(true);
|
|
|
const currentUser = useCurrentUser();
|
|
|
const isGuestUser = useIsGuestUser();
|
|
|
const isReadOnlyUser = useIsReadOnlyUser();
|
|
|
- const isLocalAccountRegistrationEnabled = useAtomValue(isLocalAccountRegistrationEnabledAtom);
|
|
|
+ const isLocalAccountRegistrationEnabled = useAtomValue(
|
|
|
+ isLocalAccountRegistrationEnabledAtom,
|
|
|
+ );
|
|
|
const isLinkSharingDisabled = useAtomValue(disableLinkSharingAtom);
|
|
|
const isSharedUser = useIsSharedUser();
|
|
|
|
|
|
@@ -293,67 +346,87 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
|
|
|
const path = currentPage?.path ?? currentPathname;
|
|
|
|
|
|
- const [isPageTemplateModalShown, setIsPageTempleteModalShown] = useState(false);
|
|
|
-
|
|
|
- const duplicateItemClickedHandler = useCallback(async (page: IPageForPageDuplicateModal) => {
|
|
|
- const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
|
|
|
- router.push(toPath);
|
|
|
- };
|
|
|
- openDuplicateModal(page, { onDuplicated: duplicatedHandler });
|
|
|
- }, [openDuplicateModal, router]);
|
|
|
-
|
|
|
- const renameItemClickedHandler = useCallback(async (page: IPageToRenameWithMeta<IPageInfoForEntity>) => {
|
|
|
- const renamedHandler: OnRenamedFunction = () => {
|
|
|
- fetchCurrentPage({ force: true });
|
|
|
- mutatePageInfo();
|
|
|
- mutatePageTree();
|
|
|
- mutateRecentlyUpdated();
|
|
|
- };
|
|
|
- openRenameModal(page, { onRenamed: renamedHandler });
|
|
|
- }, [fetchCurrentPage, mutatePageInfo, openRenameModal]);
|
|
|
-
|
|
|
- const deleteItemClickedHandler = useCallback((pageWithMeta: IPageWithMeta) => {
|
|
|
- const deletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
|
- if (typeof pathOrPathsToDelete !== 'string') {
|
|
|
- return;
|
|
|
- }
|
|
|
+ const [isPageTemplateModalShown, setIsPageTempleteModalShown] =
|
|
|
+ useState(false);
|
|
|
+
|
|
|
+ const duplicateItemClickedHandler = useCallback(
|
|
|
+ async (page: IPageForPageDuplicateModal) => {
|
|
|
+ const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
|
|
|
+ router.push(toPath);
|
|
|
+ };
|
|
|
+ openDuplicateModal(page, { onDuplicated: duplicatedHandler });
|
|
|
+ },
|
|
|
+ [openDuplicateModal, router],
|
|
|
+ );
|
|
|
|
|
|
- const path = pathOrPathsToDelete;
|
|
|
+ const renameItemClickedHandler = useCallback(
|
|
|
+ async (page: IPageToRenameWithMeta<IPageInfoForEntity>) => {
|
|
|
+ const renamedHandler: OnRenamedFunction = () => {
|
|
|
+ fetchCurrentPage({ force: true });
|
|
|
+ mutatePageInfo();
|
|
|
+ mutatePageTree();
|
|
|
+ mutateRecentlyUpdated();
|
|
|
+ };
|
|
|
+ openRenameModal(page, { onRenamed: renamedHandler });
|
|
|
+ },
|
|
|
+ [fetchCurrentPage, mutatePageInfo, openRenameModal],
|
|
|
+ );
|
|
|
|
|
|
- if (isCompletely) {
|
|
|
- // redirect to NotFound Page
|
|
|
- router.push(path);
|
|
|
- }
|
|
|
- else if (currentPathname != null) {
|
|
|
- router.push(currentPathname);
|
|
|
- }
|
|
|
+ const deleteItemClickedHandler = useCallback(
|
|
|
+ (pageWithMeta: IPageWithMeta) => {
|
|
|
+ const deletedHandler: OnDeletedFunction = (
|
|
|
+ pathOrPathsToDelete,
|
|
|
+ isRecursively,
|
|
|
+ isCompletely,
|
|
|
+ ) => {
|
|
|
+ if (typeof pathOrPathsToDelete !== 'string') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- fetchCurrentPage({ force: true });
|
|
|
- mutatePageInfo();
|
|
|
- mutatePageTree();
|
|
|
- mutateRecentlyUpdated();
|
|
|
- };
|
|
|
- openDeleteModal([pageWithMeta], { onDeleted: deletedHandler });
|
|
|
- }, [currentPathname, fetchCurrentPage, openDeleteModal, router, mutatePageInfo]);
|
|
|
-
|
|
|
- const switchContentWidthHandler = useCallback(async (pageId: string, value: boolean) => {
|
|
|
- if (!isSharedPage) {
|
|
|
- await updateContentWidth(pageId, value);
|
|
|
- fetchCurrentPage({ force: true });
|
|
|
- }
|
|
|
- }, [isSharedPage, fetchCurrentPage]);
|
|
|
+ const path = pathOrPathsToDelete;
|
|
|
+
|
|
|
+ if (isCompletely) {
|
|
|
+ // redirect to NotFound Page
|
|
|
+ router.push(path);
|
|
|
+ } else if (currentPathname != null) {
|
|
|
+ router.push(currentPathname);
|
|
|
+ }
|
|
|
+
|
|
|
+ fetchCurrentPage({ force: true });
|
|
|
+ mutatePageInfo();
|
|
|
+ mutatePageTree();
|
|
|
+ mutateRecentlyUpdated();
|
|
|
+ };
|
|
|
+ openDeleteModal([pageWithMeta], { onDeleted: deletedHandler });
|
|
|
+ },
|
|
|
+ [
|
|
|
+ currentPathname,
|
|
|
+ fetchCurrentPage,
|
|
|
+ openDeleteModal,
|
|
|
+ router,
|
|
|
+ mutatePageInfo,
|
|
|
+ ],
|
|
|
+ );
|
|
|
+
|
|
|
+ const switchContentWidthHandler = useCallback(
|
|
|
+ async (pageId: string, value: boolean) => {
|
|
|
+ if (!isSharedPage) {
|
|
|
+ await updateContentWidth(pageId, value);
|
|
|
+ fetchCurrentPage({ force: true });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ [isSharedPage, fetchCurrentPage],
|
|
|
+ );
|
|
|
|
|
|
const additionalMenuItemsRenderer = useCallback(() => {
|
|
|
if (revisionId == null || pageId == null) {
|
|
|
return (
|
|
|
<>
|
|
|
- {!isReadOnlyUser
|
|
|
- && (
|
|
|
- <CreateTemplateMenuItems
|
|
|
- onClickTemplateMenuItem={() => setIsPageTempleteModalShown(true)}
|
|
|
- />
|
|
|
- )
|
|
|
- }
|
|
|
+ {!isReadOnlyUser && (
|
|
|
+ <CreateTemplateMenuItems
|
|
|
+ onClickTemplateMenuItem={() => setIsPageTempleteModalShown(true)}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</>
|
|
|
);
|
|
|
}
|
|
|
@@ -371,8 +444,7 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
onClickTemplateMenuItem={() => setIsPageTempleteModalShown(true)}
|
|
|
/>
|
|
|
</>
|
|
|
- )
|
|
|
- }
|
|
|
+ )}
|
|
|
</>
|
|
|
);
|
|
|
}, [isLinkSharingDisabled, pageId, revisionId, isReadOnlyUser]);
|
|
|
@@ -389,11 +461,12 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
<Sticky
|
|
|
className="z-1"
|
|
|
enabled={!isPrinting}
|
|
|
- onStateChange={status => setStickyActive(status.status === Sticky.STATUS_FIXED)}
|
|
|
+ onStateChange={(status) =>
|
|
|
+ setStickyActive(status.status === Sticky.STATUS_FIXED)
|
|
|
+ }
|
|
|
innerActiveClass="w-100 end-0"
|
|
|
>
|
|
|
<GroundGlassBar>
|
|
|
-
|
|
|
<nav
|
|
|
className={`${styles['grw-contextual-sub-navigation']}
|
|
|
d-flex align-items-center justify-content-end pe-2 pe-sm-3 pe-md-4 py-1 gap-2 gap-md-4 d-print-none
|
|
|
@@ -401,7 +474,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
data-testid="grw-contextual-sub-nav"
|
|
|
id="grw-contextual-sub-nav"
|
|
|
>
|
|
|
-
|
|
|
<PageControls
|
|
|
pageId={pageId}
|
|
|
revisionId={revisionId}
|
|
|
@@ -431,12 +503,23 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
<span>
|
|
|
<span className="d-inline-block" id="sign-up-link">
|
|
|
<Link
|
|
|
- href={!isLocalAccountRegistrationEnabled ? '#' : '/login#register'}
|
|
|
+ href={
|
|
|
+ !isLocalAccountRegistrationEnabled
|
|
|
+ ? '#'
|
|
|
+ : '/login#register'
|
|
|
+ }
|
|
|
className={`btn me-2 ${!isLocalAccountRegistrationEnabled ? 'opacity-25' : ''}`}
|
|
|
- style={{ pointerEvents: !isLocalAccountRegistrationEnabled ? 'none' : undefined }}
|
|
|
+ style={{
|
|
|
+ pointerEvents: !isLocalAccountRegistrationEnabled
|
|
|
+ ? 'none'
|
|
|
+ : undefined,
|
|
|
+ }}
|
|
|
prefetch={false}
|
|
|
>
|
|
|
- <span className="material-symbols-outlined me-1">person_add</span>{t('Sign up')}
|
|
|
+ <span className="material-symbols-outlined me-1">
|
|
|
+ person_add
|
|
|
+ </span>
|
|
|
+ {t('Sign up')}
|
|
|
</Link>
|
|
|
</span>
|
|
|
{!isLocalAccountRegistrationEnabled && (
|
|
|
@@ -445,13 +528,17 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
</UncontrolledTooltip>
|
|
|
)}
|
|
|
</span>
|
|
|
- <Link href="/login#login" className="btn btn-primary" prefetch={false}>
|
|
|
- <span className="material-symbols-outlined me-1">login</span>{t('Sign in')}
|
|
|
+ <Link
|
|
|
+ href="/login#login"
|
|
|
+ className="btn btn-primary"
|
|
|
+ prefetch={false}
|
|
|
+ >
|
|
|
+ <span className="material-symbols-outlined me-1">login</span>
|
|
|
+ {t('Sign in')}
|
|
|
</Link>
|
|
|
</div>
|
|
|
)}
|
|
|
</nav>
|
|
|
-
|
|
|
</GroundGlassBar>
|
|
|
</Sticky>
|
|
|
|
|
|
@@ -464,8 +551,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
)}
|
|
|
</>
|
|
|
);
|
|
|
-
|
|
|
};
|
|
|
|
|
|
-
|
|
|
export default GrowiContextualSubNavigation;
|