diff --git a/apps/sensenet/src/components/ContentBreadcrumbs.tsx b/apps/sensenet/src/components/ContentBreadcrumbs.tsx index f07f13317..81c2d7713 100644 --- a/apps/sensenet/src/components/ContentBreadcrumbs.tsx +++ b/apps/sensenet/src/components/ContentBreadcrumbs.tsx @@ -22,12 +22,21 @@ const useStyles = makeStyles((theme: Theme) => { }, marginLeft: 'auto', }, + treeActionWrapper: { + marginRight: '7.5%', + ' & .MuiIconButton-root': { + color: theme.palette.type === 'light' ? theme.palette.common.black : theme.palette.common.white, + }, + // marginLeft: '10px', + borderLeft: theme.palette.type === 'light' ? '1px solid #DBDBDB' : '1px solid rgba(255, 255, 255, 0.11)', + }, }) }) type ContentBreadcrumbsProps = { onItemClick?: (item: BreadcrumbItem) => void batchActions?: boolean + treeActions?: boolean } export const ContentBreadcrumbs = (props: ContentBreadcrumbsProps) => { @@ -78,6 +87,68 @@ export const ContentBreadcrumbs = (pr : history.push(getPrimaryActionUrl({ content: item.content, repository, uiSettings, location })) }} /> + {props.treeActions && selected.length > 0 ? ( +
+ + { + openDialog({ + name: 'delete', + props: { content: selected }, + dialogProps: { disableBackdropClick: true, disableEscapeKeyDown: true }, + }) + }}> + + + + + { + openDialog({ + name: 'copy-move', + props: { + content: selected, + currentParent: parent, + operation: 'move', + }, + dialogProps: { + disableBackdropClick: true, + disableEscapeKeyDown: true, + classes: { paper: globalClasses.pickerDialog }, + }, + }) + }}> + + + + + { + openDialog({ + name: 'copy-move', + props: { + content: selected, + currentParent: parent, + operation: 'copy', + }, + dialogProps: { + disableBackdropClick: true, + disableEscapeKeyDown: true, + classes: { paper: globalClasses.pickerDialog }, + }, + }) + }}> + + + +
+ ) : null} {props.batchActions && selected.length > 0 ? (
diff --git a/apps/sensenet/src/components/content/Explore.tsx b/apps/sensenet/src/components/content/Explore.tsx index 78dd8f518..cfc60f9e3 100644 --- a/apps/sensenet/src/components/content/Explore.tsx +++ b/apps/sensenet/src/components/content/Explore.tsx @@ -11,7 +11,7 @@ import { } from '@sensenet/hooks-react' import { ColumnSetting } from '@sensenet/list-controls-react/src/ContentList/content-list-base-props' import { clsx } from 'clsx' -import React, { useCallback, useContext, useState } from 'react' +import React, { useCallback, useContext, useEffect, useState } from 'react' import { useHistory } from 'react-router' import { ResponsivePersonalSettings } from '../../context' import { globals, useGlobalStyles } from '../../globalStyles' @@ -96,6 +96,7 @@ export function Explore({ const pathFromUrl = useQuery().get('path') const snRoute = useSnRoute() const activeAction = snRoute.match!.params.action + const [selected, setSelected] = useState([]) const onActivateItemOverride = async (activeItem: GenericContent) => { const expandedItem = await repository.load({ @@ -186,6 +187,10 @@ export function Explore({ ) } + useEffect(() => { + selectionService.selection.setValue(selected) + }, [selected, selectionService.selection]) + return ( @@ -197,6 +202,7 @@ export function Explore({ onNavigate(i.content) }} batchActions={true} + treeActions={true} />
@@ -204,6 +210,7 @@ export function Explore({ { onNavigate(item) + setSelected([item]) }} parentPath={PathHelper.isAncestorOf(rootPath, currentPath) ? rootPath : currentPath} activeItemPath={currentPath} diff --git a/apps/sensenet/src/components/tree/tree-with-data.tsx b/apps/sensenet/src/components/tree/tree-with-data.tsx index e5f7ef1f4..3bd515b4d 100644 --- a/apps/sensenet/src/components/tree/tree-with-data.tsx +++ b/apps/sensenet/src/components/tree/tree-with-data.tsx @@ -263,7 +263,10 @@ export default function TreeWithData(props: TreeWithDataProps) { }), ] - return () => subscriptions.forEach((s) => s.dispose()) + return () => { + console.log('unmounting') + subscriptions.forEach((s) => s.dispose()) + } }, [ treeData, eventHub.onContentDeleted, diff --git a/apps/sensenet/src/localization/default.ts b/apps/sensenet/src/localization/default.ts index e169886d2..6bf13cb09 100644 --- a/apps/sensenet/src/localization/default.ts +++ b/apps/sensenet/src/localization/default.ts @@ -549,6 +549,12 @@ const values = { copy: 'Copy selected items', copyPath: 'Copy path', }, + treeActions: { + delete: 'Delete selected items', + move: 'Move selected items', + copy: 'Copy selected items', + copyPath: 'Copy path', + }, referenceContentListDialog: { errorAlreadyInList: 'The selected item is already in the list', },