From 871aea4058a625bcf081cd2db35d75c7b467fdbc Mon Sep 17 00:00:00 2001 From: Herman Wikner Date: Wed, 20 Mar 2024 13:27:55 +0100 Subject: [PATCH] feat(structure): set selection in presence location --- .../src/structure/panes/document/DocumentPaneProvider.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx b/packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx index fad10c844eda..a612e0477ddc 100644 --- a/packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx +++ b/packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx @@ -1,4 +1,5 @@ /* eslint-disable camelcase */ +import {type EditorSelection} from '@sanity/portable-text-editor' import {isActionEnabled} from '@sanity/schema/_internal' import { type ObjectSchemaType, @@ -263,7 +264,7 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => { ) const handleFocus = useCallback( - (nextFocusPath: Path) => { + (nextFocusPath: Path, payload?: Record) => { setFocusPath(nextFocusPath) if (focusPathRef.current !== nextFocusPath) { @@ -277,6 +278,7 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => { documentId, path: nextFocusPath, lastActiveAt: new Date().toISOString(), + selection: payload?.selection as EditorSelection | undefined, }, ]) },