mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Merge pull request #20712 from overleaf/dp-click-mini-panel
Clicking on an entry in the mini review panel opens the full panel GitOrigin-RevId: 4c925435a09f56ae5b02c53951185c67eb0413a2
This commit is contained in:
parent
b2dab4b1c0
commit
a40fb42fed
1 changed files with 7 additions and 0 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
highlightRanges,
|
||||
} from '@/features/source-editor/extensions/ranges'
|
||||
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
|
||||
export const ReviewPanelEntry: FC<{
|
||||
position: number
|
||||
|
@ -34,9 +35,14 @@ export const ReviewPanelEntry: FC<{
|
|||
const view = useCodeMirrorViewContext()
|
||||
const { openDocId } = useEditorManagerContext()
|
||||
const [focused, setFocused] = useState(false)
|
||||
const { setReviewPanelOpen } = useLayoutContext()
|
||||
|
||||
const highlighted = isSelectionWithinOp(op, state.selection.main)
|
||||
|
||||
const openReviewPanel = useCallback(() => {
|
||||
setReviewPanelOpen(true)
|
||||
}, [setReviewPanelOpen])
|
||||
|
||||
const focusHandler = useCallback(() => {
|
||||
if (selectLineOnFocus) {
|
||||
openDocId(docId, { gotoOffset: position, keepCurrentView: true })
|
||||
|
@ -55,6 +61,7 @@ export const ReviewPanelEntry: FC<{
|
|||
|
||||
return (
|
||||
<div
|
||||
onMouseDown={openReviewPanel} // Using onMouseDown rather than onClick to guarantee that it fires before onFocus
|
||||
onFocus={focusHandler}
|
||||
onBlur={() => setFocused(false)}
|
||||
onMouseEnter={() => {
|
||||
|
|
Loading…
Reference in a new issue