Skip to content

Commit

Permalink
fix(core): skip reset presence selection on PTE blur (#6511)
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanwikner committed Apr 29, 2024
1 parent 3b4a7e6 commit f0c94f1
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
})
}, [onPathFocus, portableTextMemberItems])

const resetSelectionPresence = useCallback(() => {
onPathFocus(props.path, {
selection: null,
})
}, [onPathFocus, props.path])

const nextSelectionRef = useRef<EditorSelection | null>(null)

// Handle editor changes
Expand Down Expand Up @@ -216,11 +210,6 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
case 'blur':
onBlur(change.event)
setHasFocusWithin(false)

// When the editor blurs, we reset the presence selection
// in order to remove the presence cursor for the current user
// since they no longer have an active selection in the editor.
resetSelectionPresence()
break
case 'undo':
case 'redo':
Expand All @@ -241,15 +230,7 @@ export function PortableTextInput(props: PortableTextInputProps): ReactNode {
onEditorChange(change, editorRef.current)
}
},
[
editorRef,
onEditorChange,
onChange,
setFocusPathFromEditorSelection,
onBlur,
resetSelectionPresence,
toast,
],
[editorRef, onEditorChange, onChange, setFocusPathFromEditorSelection, onBlur, toast],
)

useEffect(() => {
Expand Down

0 comments on commit f0c94f1

Please sign in to comment.