|
@@ -12,6 +12,8 @@ import {
|
|
|
} from '~/stores/modal';
|
|
} from '~/stores/modal';
|
|
|
import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
|
|
import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
|
|
|
|
|
|
|
|
|
|
+import { useIsEnabledAttachTitleHeader } from '~/stores/context';
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Utility to generate initial node
|
|
* Utility to generate initial node
|
|
|
*/
|
|
*/
|
|
@@ -62,6 +64,7 @@ const renderByInitialNode = (
|
|
|
initialNode: ItemNode,
|
|
initialNode: ItemNode,
|
|
|
isEnableActions: boolean,
|
|
isEnableActions: boolean,
|
|
|
targetPathOrId?: string,
|
|
targetPathOrId?: string,
|
|
|
|
|
+ isEnabledAttachTitleHeader?: boolean,
|
|
|
onClickDuplicateMenuItem?: (pageId: string, path: string) => void,
|
|
onClickDuplicateMenuItem?: (pageId: string, path: string) => void,
|
|
|
onClickRenameMenuItem?: (pageId: string, revisionId: string, path: string) => void,
|
|
onClickRenameMenuItem?: (pageId: string, revisionId: string, path: string) => void,
|
|
|
onClickDeleteMenuItem?: (pageToDelete: IPageForPageDeleteModal | null, isAbleToDeleteCompletely: boolean) => void,
|
|
onClickDeleteMenuItem?: (pageToDelete: IPageForPageDeleteModal | null, isAbleToDeleteCompletely: boolean) => void,
|
|
@@ -74,6 +77,7 @@ const renderByInitialNode = (
|
|
|
targetPathOrId={targetPathOrId}
|
|
targetPathOrId={targetPathOrId}
|
|
|
itemNode={initialNode}
|
|
itemNode={initialNode}
|
|
|
isOpen
|
|
isOpen
|
|
|
|
|
+ isEnabledAttachTitleHeader={isEnabledAttachTitleHeader}
|
|
|
isEnableActions={isEnableActions}
|
|
isEnableActions={isEnableActions}
|
|
|
onClickDuplicateMenuItem={onClickDuplicateMenuItem}
|
|
onClickDuplicateMenuItem={onClickDuplicateMenuItem}
|
|
|
onClickRenameMenuItem={onClickRenameMenuItem}
|
|
onClickRenameMenuItem={onClickRenameMenuItem}
|
|
@@ -97,6 +101,7 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
const { data: ancestorsChildrenData, error: error1 } = useSWRxPageAncestorsChildren(targetPath);
|
|
const { data: ancestorsChildrenData, error: error1 } = useSWRxPageAncestorsChildren(targetPath);
|
|
|
const { mutate: mutateChildren } = useSWRxPageChildren(targetPathOrId);
|
|
const { mutate: mutateChildren } = useSWRxPageChildren(targetPathOrId);
|
|
|
const { data: rootPageData, error: error2 } = useSWRxRootPage();
|
|
const { data: rootPageData, error: error2 } = useSWRxRootPage();
|
|
|
|
|
+ const { data: isEnabledAttachTitleHeader } = useIsEnabledAttachTitleHeader();
|
|
|
const { open: openDuplicateModal } = usePageDuplicateModal();
|
|
const { open: openDuplicateModal } = usePageDuplicateModal();
|
|
|
const { open: openRenameModal } = usePageRenameModal();
|
|
const { open: openRenameModal } = usePageRenameModal();
|
|
|
const { open: openDeleteModal } = usePageDeleteModal();
|
|
const { open: openDeleteModal } = usePageDeleteModal();
|
|
@@ -150,7 +155,9 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
*/
|
|
*/
|
|
|
if (ancestorsChildrenData != null && rootPageData != null) {
|
|
if (ancestorsChildrenData != null && rootPageData != null) {
|
|
|
const initialNode = generateInitialNodeAfterResponse(ancestorsChildrenData.ancestorsChildren, new ItemNode(rootPageData.rootPage));
|
|
const initialNode = generateInitialNodeAfterResponse(ancestorsChildrenData.ancestorsChildren, new ItemNode(rootPageData.rootPage));
|
|
|
- return renderByInitialNode(initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem);
|
|
|
|
|
|
|
+ return renderByInitialNode(
|
|
|
|
|
+ initialNode, isEnableActions, targetPathOrId, isEnabledAttachTitleHeader, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -158,7 +165,9 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
*/
|
|
*/
|
|
|
if (targetAndAncestorsData != null) {
|
|
if (targetAndAncestorsData != null) {
|
|
|
const initialNode = generateInitialNodeBeforeResponse(targetAndAncestorsData.targetAndAncestors);
|
|
const initialNode = generateInitialNodeBeforeResponse(targetAndAncestorsData.targetAndAncestors);
|
|
|
- return renderByInitialNode(initialNode, isEnableActions, targetPathOrId, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem);
|
|
|
|
|
|
|
+ return renderByInitialNode(
|
|
|
|
|
+ initialNode, isEnableActions, targetPathOrId, isEnabledAttachTitleHeader, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
return null;
|