fix(web): stop question answers from resetting the editor caret (#11337)
This commit is contained in:
1 parent
109aaae6cd
commit
dff750b1b8
1 file changed
+4
-16
@@ -10428,13 +10428,7 @@ export default function ChatView(props: ChatViewProps) {
|
||||
);
|
||||
|
||||
const onChangeActivePendingUserInputCustomAnswer = useCallback(
|
||||
(
|
||||
questionId: string,
|
||||
value: string,
|
||||
nextCursor: number,
|
||||
expandedCursor: number,
|
||||
_cursorAdjacentToMention: boolean,
|
||||
) => {
|
||||
(questionId: string, value: string) => {
|
||||
if (!activePendingUserInput) {
|
||||
return;
|
||||
}
|
||||
@@ -10454,16 +10448,10 @@ export default function ChatView(props: ChatViewProps) {
|
||||
),
|
||||
},
|
||||
}));
|
||||
const snapshot = composerRef.current?.readSnapshot();
|
||||
if (
|
||||
snapshot?.value !== value ||
|
||||
snapshot.cursor !== nextCursor ||
|
||||
snapshot.expandedCursor !== expandedCursor
|
||||
) {
|
||||
composerRef.current?.focusAt(nextCursor);
|
||||
}
|
||||
// The editor owns this selection. Resetting it before the answer renders
|
||||
// can re-enter Lexical with offsets from the previous skill token.
|
||||
},
|
||||
[activePendingUserInput, activePendingRequestKey, composerRef],
|
||||
[activePendingUserInput, activePendingRequestKey],
|
||||
);
|
||||
|
||||
const onAdvanceActivePendingUserInput = useCallback(() => {
|
||||
|
||||
Reference in new issue
Block a user