From 0492465e20315f722de956bbcba9cd693f90d3c3 Mon Sep 17 00:00:00 2001 From: NoelKova Date: Wed, 7 Aug 2024 11:13:11 +0200 Subject: [PATCH] no_action_buittons_on_refresh_content_page --- apps/sensenet/src/components/editor/text-editor.tsx | 7 ++++++- apps/sensenet/src/components/view-controls/browse-view.tsx | 3 ++- apps/sensenet/src/components/view-controls/edit-view.tsx | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/sensenet/src/components/editor/text-editor.tsx b/apps/sensenet/src/components/editor/text-editor.tsx index 3a1a1e1d1..ce46e7ecc 100644 --- a/apps/sensenet/src/components/editor/text-editor.tsx +++ b/apps/sensenet/src/components/editor/text-editor.tsx @@ -3,7 +3,7 @@ import { PathHelper } from '@sensenet/client-utils' import { ActionModel, GenericContent, Settings, File as SnFile } from '@sensenet/default-content-types' import { useLogger, useRepository } from '@sensenet/hooks-react' import React, { useEffect, useState } from 'react' -import { useLocalization } from '../../hooks' +import { useLocalization, useSelectionService } from '../../hooks' import { getMonacoLanguage } from '../../services/content-context-service' import { ContentBreadcrumbs } from '../ContentBreadcrumbs' import { FullScreenLoader } from '../full-screen-loader' @@ -50,6 +50,11 @@ export const TextEditor: React.FunctionComponent = (props) => { const [hasChanges, setHasChanges] = useState(false) const logger = useLogger('TextEditor') const [error, setError] = useState() + const selectionService = useSelectionService() + + useEffect(() => { + selectionService.selection.setValue([props.content]) + }, [props, selectionService.selection]) const saveContent = async () => { try { diff --git a/apps/sensenet/src/components/view-controls/browse-view.tsx b/apps/sensenet/src/components/view-controls/browse-view.tsx index 1f8bce22f..ad5a62d5a 100644 --- a/apps/sensenet/src/components/view-controls/browse-view.tsx +++ b/apps/sensenet/src/components/view-controls/browse-view.tsx @@ -43,9 +43,10 @@ export const BrowseView: React.FC = (props) => { }) setContent(expanedContentResponse.d) selectionService.activeContent.setValue(expanedContentResponse.d) + selectionService.selection.setValue([expanedContentResponse.d]) } getExpandedContent() - }, [repository, props.contentPath, selectionService.activeContent]) + }, [repository, props.contentPath, selectionService.activeContent, selectionService.selection]) if (content === undefined) { return null diff --git a/apps/sensenet/src/components/view-controls/edit-view.tsx b/apps/sensenet/src/components/view-controls/edit-view.tsx index e415039e6..ef66393f8 100644 --- a/apps/sensenet/src/components/view-controls/edit-view.tsx +++ b/apps/sensenet/src/components/view-controls/edit-view.tsx @@ -49,9 +49,10 @@ export const EditView: React.FC = (props) => { }) setContent(expanedContentResponse.d) selectionService.activeContent.setValue(expanedContentResponse.d) + selectionService.selection.setValue([expanedContentResponse.d]) } getExpandedContent() - }, [repository, props.contentPath, selectionService.activeContent]) + }, [repository, props.contentPath, selectionService.activeContent, selectionService.selection]) if (content === undefined) { return null