diff --git a/apps/sensenet/src/components/grid/Grid.tsx b/apps/sensenet/src/components/grid/Grid.tsx
index 7f6d35f86..e9ad7d280 100644
--- a/apps/sensenet/src/components/grid/Grid.tsx
+++ b/apps/sensenet/src/components/grid/Grid.tsx
@@ -7,6 +7,7 @@ import {
ColumnApi,
GridApi,
GridReadyEvent,
+ RowClickedEvent,
RowDoubleClickedEvent,
SelectionChangedEvent,
} from 'ag-grid-community'
@@ -86,10 +87,19 @@ export function Grid(props: GridProps
}, [children, isGridLoading, setLoadingWithMinDuration])
const onRowDoubleClicked = (item: RowDoubleClickedEvent) => {
+ if (item.data) {
+ props.onActiveItemChange?.(item.data)
+ }
setLoadingWithMinDuration(true)
item.data.isFolder ? props.onParentChange(item.data) : props.onActivateItem(item.data)
}
+ const onRowClicked = (item: RowClickedEvent) => {
+ if (item.data) {
+ props.onActiveItemChange?.(item.data)
+ }
+ }
+
const onSelectionChanged = (params: SelectionChangedEvent) => {
const selectedIds = params.api.getSelectedRows().map((c) => c.Id)
const selectedItems: GenericContent[] = children.filter((item) => selectedIds.includes(item.Id))
@@ -102,6 +112,7 @@ export function Grid(props: GridProps
if (!event.node || !event.event) return
const mouseEvent = event.event as MouseEvent
setContextMenuItem(event.data)
+ event.data && props.onActiveItemChange?.(event.data)
setContextMenuAnchorPos({ top: mouseEvent.clientY, left: mouseEvent.clientX })
setIsContextMenuOpened(true)
}
@@ -231,6 +242,7 @@ export function Grid(props: GridProps
rowSelection={'multiple'}
suppressReactUi={true}
tooltipShowDelay={100}
+ onRowClicked={onRowClicked}
onRowDoubleClicked={onRowDoubleClicked}
preventDefaultOnContextMenu={true}
onGridReady={onGridReady}
diff --git a/apps/sensenet/src/components/tree/StyledTreeItem.tsx b/apps/sensenet/src/components/tree/StyledTreeItem.tsx
index 1629f2234..75282f285 100644
--- a/apps/sensenet/src/components/tree/StyledTreeItem.tsx
+++ b/apps/sensenet/src/components/tree/StyledTreeItem.tsx
@@ -5,7 +5,7 @@ import { useRepository } from '@sensenet/hooks-react'
import React, { MouseEventHandler, useCallback, useContext, useEffect, useRef, useState } from 'react'
import { useHistory } from 'react-router'
import { ResponsivePersonalSettings } from '../../context'
-import { useQuery, useSnRoute } from '../../hooks'
+import { useQuery, useSelectionService, useSnRoute } from '../../hooks'
import { getPrimaryActionUrl, navigateToAction } from '../../services'
import { ContentContextMenu } from '../context-menu/content-context-menu'
import { Icon } from '../Icon'
@@ -37,6 +37,7 @@ export const StyledTreeItem = ({
const repository = useRepository()
const snRoute = useSnRoute()
const uiSettings = useContext(ResponsivePersonalSettings)
+ const selectionService = useSelectionService()
const currentPath = useQuery().get('path')
const mountedRef = useRef(true)
@@ -141,6 +142,7 @@ export const StyledTreeItem = ({
const displayName = contentvalue.DisplayName
if (displayName?.endsWith('.settings') || displayName?.endsWith('.xml')) {
+ selectionService.activeContent.setValue(contentvalue)
history.push(
getPrimaryActionUrl({ content: contentvalue, repository, uiSettings, location: history.location, snRoute }),
)
@@ -148,6 +150,7 @@ export const StyledTreeItem = ({
}
if (editMode) {
+ selectionService.activeContent.setValue(contentvalue)
navigateToAction({
history,
routeMatch: snRoute.match!,
@@ -155,6 +158,7 @@ export const StyledTreeItem = ({
queryParams: { content: contentvalue.Path.replace(snRoute.path, '') },
})
} else {
+ selectionService.activeContent.setValue(contentvalue)
const itemPath = (event.target as HTMLElement).closest('[data-path]')?.getAttribute('data-path')
setExpandItems((prev) => {
const updated = new Set(prev)
@@ -176,11 +180,12 @@ export const StyledTreeItem = ({
if (isDisabled) return
event.preventDefault()
event.stopPropagation()
+ selectionService.activeContent.setValue(contentvalue)
setContextMenuItem(contentvalue)
setContextMenuAnchorPos({ top: event.clientY, left: event.clientX })
setIsContextMenuOpened(true)
},
- [contentvalue, isDisabled],
+ [contentvalue, isDisabled, selectionService.activeContent],
)
return (
diff --git a/apps/sensenet/src/hooks/use-tree-navigation.ts b/apps/sensenet/src/hooks/use-tree-navigation.ts
index 3ddf0465d..015156412 100644
--- a/apps/sensenet/src/hooks/use-tree-navigation.ts
+++ b/apps/sensenet/src/hooks/use-tree-navigation.ts
@@ -3,16 +3,19 @@ import { useCallback, useEffect, useState } from 'react'
import { useHistory, useRouteMatch } from 'react-router'
import { resolvePathParams } from '../application-paths'
import { useQuery } from '../hooks/use-query'
+import { useSelectionService } from '../hooks/use-selection-service'
import { pathWithQueryParams } from '../services/query-string-builder'
export const useTreeNavigation = (defaultPath: string) => {
const history = useHistory()
const match = useRouteMatch<{ browseType: string }>()
+ const selectionService = useSelectionService()
const pathFromQuery = useQuery().get('path')
const [currentPath, setCurrentPath] = useState(pathFromQuery ? decodeURIComponent(pathFromQuery) : '')
const onNavigate = useCallback(
(content: GenericContent) => {
+ selectionService.activeContent.setValue(content)
const searchParams = new URLSearchParams(history.location.search)
searchParams.delete('content')
const newPath = content.Path.replace(defaultPath, '')
@@ -26,7 +29,7 @@ export const useTreeNavigation = (defaultPath: string) => {
)
setCurrentPath(newPath)
},
- [history, match.path, match.params, defaultPath],
+ [history, match.path, match.params, defaultPath, selectionService.activeContent],
)
useEffect(() => {
diff --git a/apps/sensenet/src/localization/default.ts b/apps/sensenet/src/localization/default.ts
index 78c43cf1f..74665c28d 100644
--- a/apps/sensenet/src/localization/default.ts
+++ b/apps/sensenet/src/localization/default.ts
@@ -22,6 +22,8 @@ const values = {
title: 'Search',
clear: 'Clear',
actions: 'Actions',
+ actionContext: 'Actions for: ',
+ noActionContext: 'No content selected for actions.',
help: {
readMeTitle: 'ReadMe',
readMeDescription: 'Opens the latest readme.md file from GitHub in a new window',
diff --git a/apps/sensenet/src/localization/hungarian.ts b/apps/sensenet/src/localization/hungarian.ts
index 31433a747..4ec737fea 100644
--- a/apps/sensenet/src/localization/hungarian.ts
+++ b/apps/sensenet/src/localization/hungarian.ts
@@ -12,6 +12,8 @@ const values: Localization = {
commandPalette: {
title: 'Command palette megnyitása',
actions: 'Műveletek',
+ actionContext: 'Műveletek ezen: ',
+ noActionContext: 'Nincs kiválasztott tartalom a műveletekhez.',
searchSuggestionList: 'Keresési javaslatok listája',
},
contentInfoDialog: {