|
@@ -45,18 +45,19 @@ type ItemControlProps = {
|
|
|
page: Partial<IPageHasId>
|
|
page: Partial<IPageHasId>
|
|
|
isEnableActions: boolean
|
|
isEnableActions: boolean
|
|
|
isDeletable: boolean
|
|
isDeletable: boolean
|
|
|
|
|
+ onClickPlusButton?(): void
|
|
|
onClickDeleteButton?(): void
|
|
onClickDeleteButton?(): void
|
|
|
onClickRenameButton?(): void
|
|
onClickRenameButton?(): void
|
|
|
- onClickPlusButtonHandler?(): void
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const ItemControl: FC<ItemControlProps> = memo((props: ItemControlProps) => {
|
|
const ItemControl: FC<ItemControlProps> = memo((props: ItemControlProps) => {
|
|
|
const onClickPlusButton = () => {
|
|
const onClickPlusButton = () => {
|
|
|
- if (props.onClickPlusButtonHandler == null) {
|
|
|
|
|
|
|
+ console.log('プラスボタン!');
|
|
|
|
|
+ if (props.onClickPlusButton == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- props.onClickPlusButtonHandler();
|
|
|
|
|
|
|
+ props.onClickPlusButton();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onClickDeleteButtonHandler = () => {
|
|
const onClickDeleteButtonHandler = () => {
|
|
@@ -165,6 +166,10 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
setIsOpen(!isOpen);
|
|
setIsOpen(!isOpen);
|
|
|
}, [isOpen]);
|
|
}, [isOpen]);
|
|
|
|
|
|
|
|
|
|
+ const onClickPlusButton = useCallback(() => {
|
|
|
|
|
+ setNewPageInputShown(true);
|
|
|
|
|
+ }, []);
|
|
|
|
|
+
|
|
|
const onClickDeleteButton = useCallback(() => {
|
|
const onClickDeleteButton = useCallback(() => {
|
|
|
if (onClickDeleteByPage == null) {
|
|
if (onClickDeleteByPage == null) {
|
|
|
return;
|
|
return;
|
|
@@ -207,7 +212,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// TODO: go to create page page
|
|
// TODO: go to create page page
|
|
|
- const onPressEnterHandler = () => {
|
|
|
|
|
|
|
+ const onPressEnterForCreateHandler = () => {
|
|
|
toastWarning(t('search_result.currently_not_implemented'));
|
|
toastWarning(t('search_result.currently_not_implemented'));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -271,9 +276,9 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
<div className="grw-pagetree-control d-none">
|
|
<div className="grw-pagetree-control d-none">
|
|
|
<ItemControl
|
|
<ItemControl
|
|
|
page={page}
|
|
page={page}
|
|
|
|
|
+ onClickPlusButton={onClickPlusButton}
|
|
|
onClickDeleteButton={onClickDeleteButton}
|
|
onClickDeleteButton={onClickDeleteButton}
|
|
|
onClickRenameButton={onClickRenameButton}
|
|
onClickRenameButton={onClickRenameButton}
|
|
|
- onClickPlusButtonHandler={() => { setNewPageInputShown(true) }}
|
|
|
|
|
isEnableActions={isEnableActions}
|
|
isEnableActions={isEnableActions}
|
|
|
isDeletable={!page.isEmpty && !isTopPage(page.path as string)}
|
|
isDeletable={!page.isEmpty && !isTopPage(page.path as string)}
|
|
|
/>
|
|
/>
|
|
@@ -285,7 +290,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
isShown={isNewPageInputShown}
|
|
isShown={isNewPageInputShown}
|
|
|
placeholder={t('Input page name')}
|
|
placeholder={t('Input page name')}
|
|
|
onClickOutside={() => { setNewPageInputShown(false) }}
|
|
onClickOutside={() => { setNewPageInputShown(false) }}
|
|
|
- onPressEnter={onPressEnterHandler}
|
|
|
|
|
|
|
+ onPressEnter={onPressEnterForCreateHandler}
|
|
|
inputValidator={inputValidator}
|
|
inputValidator={inputValidator}
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|