mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #21438 from overleaf/dp-edit-comment-popover
Dont select entry from textarea when review panel is mini GitOrigin-RevId: 5900ae11ec01bb40100e19497557469e6dac1615
This commit is contained in:
parent
73f7f73396
commit
7c613cdceb
1 changed files with 14 additions and 6 deletions
|
@ -47,8 +47,7 @@ export const ReviewPanelEntry: FC<{
|
||||||
const { openDocId, getCurrentDocId } = useEditorManagerContext()
|
const { openDocId, getCurrentDocId } = useEditorManagerContext()
|
||||||
const [selected, setSelected] = useState(false)
|
const [selected, setSelected] = useState(false)
|
||||||
const [focused, setFocused] = useState(false)
|
const [focused, setFocused] = useState(false)
|
||||||
const { setReviewPanelOpen } = useLayoutContext()
|
const { setReviewPanelOpen, reviewPanelOpen } = useLayoutContext()
|
||||||
|
|
||||||
const highlighted = isSelectionWithinOp(op, state.selection.main)
|
const highlighted = isSelectionWithinOp(op, state.selection.main)
|
||||||
|
|
||||||
const openReviewPanel = useCallback(() => {
|
const openReviewPanel = useCallback(() => {
|
||||||
|
@ -62,10 +61,11 @@ export const ReviewPanelEntry: FC<{
|
||||||
if (
|
if (
|
||||||
event.target instanceof HTMLButtonElement ||
|
event.target instanceof HTMLButtonElement ||
|
||||||
event.target instanceof HTMLLinkElement ||
|
event.target instanceof HTMLLinkElement ||
|
||||||
event.target instanceof HTMLAnchorElement
|
event.target instanceof HTMLAnchorElement ||
|
||||||
|
(event.target instanceof HTMLTextAreaElement && !reviewPanelOpen)
|
||||||
) {
|
) {
|
||||||
// Don't focus if the click was on a button/link/anchor as we
|
// Ignore focus events on certain elements so as to not affect
|
||||||
// don't want to affect its behaviour
|
// their behavior
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,15 @@ export const ReviewPanelEntry: FC<{
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[getCurrentDocId, docId, selectLineOnFocus, view, position, openDocId]
|
[
|
||||||
|
getCurrentDocId,
|
||||||
|
docId,
|
||||||
|
selectLineOnFocus,
|
||||||
|
view,
|
||||||
|
position,
|
||||||
|
openDocId,
|
||||||
|
reviewPanelOpen,
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
// Clear op highlight on dismount
|
// Clear op highlight on dismount
|
||||||
|
|
Loading…
Reference in a new issue