|
@@ -28,6 +28,7 @@ import { mutatePageTree } from '~/stores/page-listing';
|
|
|
import {
|
|
import {
|
|
|
useEditorMode, useIsAbleToShowPageManagement,
|
|
useEditorMode, useIsAbleToShowPageManagement,
|
|
|
useIsAbleToChangeEditorMode,
|
|
useIsAbleToChangeEditorMode,
|
|
|
|
|
+ useSelectedGrant,
|
|
|
} from '~/stores/ui';
|
|
} from '~/stores/ui';
|
|
|
|
|
|
|
|
import CreateTemplateModal from '../CreateTemplateModal';
|
|
import CreateTemplateModal from '../CreateTemplateModal';
|
|
@@ -41,7 +42,6 @@ import { Skeleton } from '../Skeleton';
|
|
|
import styles from './GrowiContextualSubNavigation.module.scss';
|
|
import styles from './GrowiContextualSubNavigation.module.scss';
|
|
|
import PageEditorModeManagerStyles from './PageEditorModeManager.module.scss';
|
|
import PageEditorModeManagerStyles from './PageEditorModeManager.module.scss';
|
|
|
|
|
|
|
|
-
|
|
|
|
|
const PageEditorModeManager = dynamic(
|
|
const PageEditorModeManager = dynamic(
|
|
|
() => import('./PageEditorModeManager').then(mod => mod.PageEditorModeManager),
|
|
() => import('./PageEditorModeManager').then(mod => mod.PageEditorModeManager),
|
|
|
{ ssr: false, loading: () => <Skeleton additionalClass={`${PageEditorModeManagerStyles['grw-page-editor-mode-manager-skeleton']}`} /> },
|
|
{ ssr: false, loading: () => <Skeleton additionalClass={`${PageEditorModeManagerStyles['grw-page-editor-mode-manager-skeleton']}`} /> },
|
|
@@ -190,13 +190,14 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
const revision = currentPage?.revision;
|
|
const revision = currentPage?.revision;
|
|
|
const revisionId = (revision != null && isPopulated(revision)) ? revision._id : undefined;
|
|
const revisionId = (revision != null && isPopulated(revision)) ? revision._id : undefined;
|
|
|
|
|
|
|
|
- const { data: editorMode, mutate: mutateEditorMode } = useEditorMode();
|
|
|
|
|
|
|
+ const { data: editorMode } = useEditorMode();
|
|
|
const { data: pageId } = useCurrentPageId();
|
|
const { data: pageId } = useCurrentPageId();
|
|
|
const { data: currentUser } = useCurrentUser();
|
|
const { data: currentUser } = useCurrentUser();
|
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
|
const { data: isReadOnlyUser } = useIsReadOnlyUser();
|
|
const { data: isReadOnlyUser } = useIsReadOnlyUser();
|
|
|
const { data: isSharedUser } = useIsSharedUser();
|
|
const { data: isSharedUser } = useIsSharedUser();
|
|
|
const { data: isContainerFluid } = useIsContainerFluid();
|
|
const { data: isContainerFluid } = useIsContainerFluid();
|
|
|
|
|
+ const { data: grantData } = useSelectedGrant();
|
|
|
|
|
|
|
|
const { data: isAbleToShowPageManagement } = useIsAbleToShowPageManagement();
|
|
const { data: isAbleToShowPageManagement } = useIsAbleToShowPageManagement();
|
|
|
const { data: isAbleToChangeEditorMode } = useIsAbleToChangeEditorMode();
|
|
const { data: isAbleToChangeEditorMode } = useIsAbleToChangeEditorMode();
|
|
@@ -213,6 +214,8 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
const { mutate: mutatePageInfo } = useSWRxPageInfo(pageId);
|
|
const { mutate: mutatePageInfo } = useSWRxPageInfo(pageId);
|
|
|
|
|
|
|
|
const path = currentPage?.path ?? currentPathname;
|
|
const path = currentPage?.path ?? currentPathname;
|
|
|
|
|
+ const grant = currentPage?.grant ?? grantData?.grant;
|
|
|
|
|
+ const grantUserGroupId = currentPage?.grantedGroup?._id ?? grantData?.grantedGroup?.id;
|
|
|
|
|
|
|
|
// TODO: implement tags for editor
|
|
// TODO: implement tags for editor
|
|
|
// refs: https://redmine.weseek.co.jp/issues/132125
|
|
// refs: https://redmine.weseek.co.jp/issues/132125
|
|
@@ -236,7 +239,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
|
|
|
|
|
const { isLinkSharingDisabled } = props;
|
|
const { isLinkSharingDisabled } = props;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// TODO: implement tags for editor
|
|
// TODO: implement tags for editor
|
|
|
// refs: https://redmine.weseek.co.jp/issues/132125
|
|
// refs: https://redmine.weseek.co.jp/issues/132125
|
|
|
// const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
|
|
// const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
|
|
@@ -355,7 +357,9 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
<PageEditorModeManager
|
|
<PageEditorModeManager
|
|
|
editorMode={editorMode}
|
|
editorMode={editorMode}
|
|
|
isBtnDisabled={!!isGuestUser || !!isReadOnlyUser}
|
|
isBtnDisabled={!!isGuestUser || !!isReadOnlyUser}
|
|
|
- onPageEditorModeButtonClicked={viewType => mutateEditorMode(viewType)}
|
|
|
|
|
|
|
+ path={path}
|
|
|
|
|
+ grant={grant}
|
|
|
|
|
+ grantUserGroupId={grantUserGroupId}
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|