|
@@ -62,7 +62,6 @@ const bookmarkMenuItemClickHandler = async(_pageId: string, _newValue: boolean):
|
|
|
await bookmarkOperation(_pageId);
|
|
await bookmarkOperation(_pageId);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Return new page path after the droppedPagePath is moved under the newParentPagePath
|
|
* Return new page path after the droppedPagePath is moved under the newParentPagePath
|
|
|
* @param droppedPagePath
|
|
* @param droppedPagePath
|
|
@@ -148,9 +147,13 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
}, 500);
|
|
}, 500);
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
- const [{ isDragging }, drag] = useDrag(() => ({
|
|
|
|
|
|
|
+ const [, drag] = useDrag({
|
|
|
type: 'PAGE_TREE',
|
|
type: 'PAGE_TREE',
|
|
|
item: { page },
|
|
item: { page },
|
|
|
|
|
+ canDrag: () => {
|
|
|
|
|
+ const isDraggable = !pagePathUtils.isUserPage(page.path || '/');
|
|
|
|
|
+ return isDraggable;
|
|
|
|
|
+ },
|
|
|
end: (item, monitor) => {
|
|
end: (item, monitor) => {
|
|
|
// in order to set d-none to dropped Item
|
|
// in order to set d-none to dropped Item
|
|
|
const dropResult = monitor.getDropResult();
|
|
const dropResult = monitor.getDropResult();
|
|
@@ -160,8 +163,9 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
},
|
|
},
|
|
|
collect: monitor => ({
|
|
collect: monitor => ({
|
|
|
isDragging: monitor.isDragging(),
|
|
isDragging: monitor.isDragging(),
|
|
|
|
|
+ canDrag: monitor.canDrag(),
|
|
|
}),
|
|
}),
|
|
|
- }));
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
const pageItemDropHandler = async(item: ItemNode) => {
|
|
const pageItemDropHandler = async(item: ItemNode) => {
|
|
|
const { page: droppedPage } = item;
|
|
const { page: droppedPage } = item;
|
|
@@ -373,6 +377,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
return null;
|
|
return null;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (!props.isScrolled && page.isTarget) {
|
|
if (!props.isScrolled && page.isTarget) {
|
|
|
document.dispatchEvent(new CustomEvent('targetItemRendered'));
|
|
document.dispatchEvent(new CustomEvent('targetItemRendered'));
|
|
@@ -406,7 +411,11 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
}, [data, isOpen, targetPathOrId]);
|
|
}, [data, isOpen, targetPathOrId]);
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <div id={`pagetree-item-${page._id}`} className={`grw-pagetree-item-container ${isOver ? 'grw-pagetree-is-over' : ''} ${shouldHide ? 'd-none' : ''}`}>
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ id={`pagetree-item-${page._id}`}
|
|
|
|
|
+ className={`grw-pagetree-item-container ${isOver ? 'grw-pagetree-is-over' : ''}
|
|
|
|
|
+ ${shouldHide ? 'd-none' : ''}`}
|
|
|
|
|
+ >
|
|
|
<li
|
|
<li
|
|
|
ref={(c) => { drag(c); drop(c) }}
|
|
ref={(c) => { drag(c); drop(c) }}
|
|
|
className={`list-group-item list-group-item-action border-0 py-0 d-flex align-items-center ${page.isTarget ? 'grw-pagetree-is-target' : ''}`}
|
|
className={`list-group-item list-group-item-action border-0 py-0 d-flex align-items-center ${page.isTarget ? 'grw-pagetree-is-target' : ''}`}
|