mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Merge pull request #21410 from overleaf/dp-mini-panel-click
Prevent clicking on mini review panel entry popovers from opening the full panel GitOrigin-RevId: a81ed154307750a756931d9fe5e893cd30d40c55
This commit is contained in:
parent
1b42fb7a89
commit
9d62c620fd
3 changed files with 28 additions and 17 deletions
|
@ -92,15 +92,10 @@ export const ReviewPanelChange = memo<{
|
||||||
docId={docId}
|
docId={docId}
|
||||||
hoverRanges={hoverRanges}
|
hoverRanges={hoverRanges}
|
||||||
disabled={accepting}
|
disabled={accepting}
|
||||||
|
onEnterEntryIndicator={onEnter}
|
||||||
|
onLeaveEntryIndicator={onLeave}
|
||||||
|
entryIndicator="edit"
|
||||||
>
|
>
|
||||||
<div
|
|
||||||
className="review-panel-entry-indicator"
|
|
||||||
onMouseEnter={onEnter}
|
|
||||||
onMouseLeave={onLeave}
|
|
||||||
>
|
|
||||||
<MaterialIcon type="edit" className="review-panel-entry-icon" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="review-panel-entry-content"
|
className="review-panel-entry-content"
|
||||||
onMouseEnter={onEnter}
|
onMouseEnter={onEnter}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {
|
||||||
} from '../context/threads-context'
|
} from '../context/threads-context'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { ReviewPanelEntry } from './review-panel-entry'
|
import { ReviewPanelEntry } from './review-panel-entry'
|
||||||
import MaterialIcon from '@/shared/components/material-icon'
|
|
||||||
import { ReviewPanelCommentContent } from './review-panel-comment-content'
|
import { ReviewPanelCommentContent } from './review-panel-comment-content'
|
||||||
import {
|
import {
|
||||||
CommentId,
|
CommentId,
|
||||||
|
@ -143,14 +142,10 @@ export const ReviewPanelComment = memo<{
|
||||||
position={comment.op.p}
|
position={comment.op.p}
|
||||||
hoverRanges={hoverRanges}
|
hoverRanges={hoverRanges}
|
||||||
disabled={processing}
|
disabled={processing}
|
||||||
|
onEnterEntryIndicator={onEnter}
|
||||||
|
onLeaveEntryIndicator={onLeave}
|
||||||
|
entryIndicator="comment"
|
||||||
>
|
>
|
||||||
<div
|
|
||||||
className="review-panel-entry-indicator"
|
|
||||||
onMouseEnter={onEnter}
|
|
||||||
onMouseLeave={onLeave}
|
|
||||||
>
|
|
||||||
<MaterialIcon type="comment" className="review-panel-entry-icon" />
|
|
||||||
</div>
|
|
||||||
<ReviewPanelCommentContent
|
<ReviewPanelCommentContent
|
||||||
comment={comment}
|
comment={comment}
|
||||||
isResolved={false}
|
isResolved={false}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { useEditorManagerContext } from '@/features/ide-react/context/editor-man
|
||||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||||
import { EditorSelection } from '@codemirror/state'
|
import { EditorSelection } from '@codemirror/state'
|
||||||
import { EditorView } from '@codemirror/view'
|
import { EditorView } from '@codemirror/view'
|
||||||
|
import MaterialIcon from '@/shared/components/material-icon'
|
||||||
|
|
||||||
export const ReviewPanelEntry: FC<{
|
export const ReviewPanelEntry: FC<{
|
||||||
position: number
|
position: number
|
||||||
|
@ -24,6 +25,9 @@ export const ReviewPanelEntry: FC<{
|
||||||
selectLineOnFocus?: boolean
|
selectLineOnFocus?: boolean
|
||||||
hoverRanges?: boolean
|
hoverRanges?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
onEnterEntryIndicator?: () => void
|
||||||
|
onLeaveEntryIndicator?: () => void
|
||||||
|
entryIndicator?: 'comment' | 'edit'
|
||||||
}> = ({
|
}> = ({
|
||||||
children,
|
children,
|
||||||
position,
|
position,
|
||||||
|
@ -34,6 +38,9 @@ export const ReviewPanelEntry: FC<{
|
||||||
docId,
|
docId,
|
||||||
hoverRanges = true,
|
hoverRanges = true,
|
||||||
disabled,
|
disabled,
|
||||||
|
onEnterEntryIndicator,
|
||||||
|
onLeaveEntryIndicator,
|
||||||
|
entryIndicator,
|
||||||
}) => {
|
}) => {
|
||||||
const state = useCodeMirrorStateContext()
|
const state = useCodeMirrorStateContext()
|
||||||
const view = useCodeMirrorViewContext()
|
const view = useCodeMirrorViewContext()
|
||||||
|
@ -98,7 +105,6 @@ export const ReviewPanelEntry: FC<{
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onMouseDown={openReviewPanel} // Using onMouseDown rather than onClick to guarantee that it fires before onFocus
|
|
||||||
onFocus={focusHandler}
|
onFocus={focusHandler}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
setSelected(false)
|
setSelected(false)
|
||||||
|
@ -141,6 +147,21 @@ export const ReviewPanelEntry: FC<{
|
||||||
transition: 'top .3s, left .1s, right .1s',
|
transition: 'top .3s, left .1s, right .1s',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{entryIndicator && (
|
||||||
|
<div
|
||||||
|
className="review-panel-entry-indicator"
|
||||||
|
onMouseEnter={onEnterEntryIndicator}
|
||||||
|
onMouseLeave={onLeaveEntryIndicator}
|
||||||
|
onMouseDown={openReviewPanel} // Using onMouseDown rather than onClick to guarantee that it fires before onFocus
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
>
|
||||||
|
<MaterialIcon
|
||||||
|
type={entryIndicator}
|
||||||
|
className="review-panel-entry-icon"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue