mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Improve selection detection for "Add comment" tooltip (#21731)
GitOrigin-RevId: cd13cacea0d6e45015997f3a831d0f127ddf8cd8
This commit is contained in:
parent
805c4f8321
commit
edb4e3d537
1 changed files with 14 additions and 17 deletions
|
@ -43,24 +43,21 @@ export const reviewTooltip = (): Extension => {
|
|||
return [
|
||||
reviewTooltipTheme,
|
||||
reviewTooltipStateField,
|
||||
EditorView.domEventHandlers({
|
||||
mouseup(event, view) {
|
||||
if (!view.state.selection.main.empty) {
|
||||
view.dispatch({
|
||||
effects: textSelectedEffect.of(view),
|
||||
EditorView.updateListener.of(update => {
|
||||
if (update.selectionSet && !update.state.selection.main.empty) {
|
||||
update.view.dispatch({
|
||||
effects: textSelectedEffect.of(update.view),
|
||||
})
|
||||
}
|
||||
},
|
||||
keyup(event, view) {
|
||||
if (
|
||||
(event.shiftKey || event.key === 'Meta') &&
|
||||
!view.state.selection.main.empty
|
||||
} else if (
|
||||
!update.startState.selection.main.empty &&
|
||||
update.state.selection.main.empty
|
||||
) {
|
||||
view.dispatch({
|
||||
effects: textSelectedEffect.of(view),
|
||||
update.view.dispatch({
|
||||
effects: removeReviewPanelTooltipEffect.of(null),
|
||||
})
|
||||
}
|
||||
},
|
||||
}),
|
||||
EditorView.domEventHandlers({
|
||||
mousedown(event, view) {
|
||||
view.dispatch({
|
||||
effects: removeReviewPanelTooltipEffect.of(null),
|
||||
|
|
Loading…
Reference in a new issue