mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02: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:
@@ -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={() => {
|
||||
|
||||
Reference in New Issue
Block a user