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 [
|
return [
|
||||||
reviewTooltipTheme,
|
reviewTooltipTheme,
|
||||||
reviewTooltipStateField,
|
reviewTooltipStateField,
|
||||||
EditorView.domEventHandlers({
|
EditorView.updateListener.of(update => {
|
||||||
mouseup(event, view) {
|
if (update.selectionSet && !update.state.selection.main.empty) {
|
||||||
if (!view.state.selection.main.empty) {
|
update.view.dispatch({
|
||||||
view.dispatch({
|
effects: textSelectedEffect.of(update.view),
|
||||||
effects: textSelectedEffect.of(view),
|
|
||||||
})
|
})
|
||||||
}
|
} else if (
|
||||||
},
|
!update.startState.selection.main.empty &&
|
||||||
keyup(event, view) {
|
update.state.selection.main.empty
|
||||||
if (
|
|
||||||
(event.shiftKey || event.key === 'Meta') &&
|
|
||||||
!view.state.selection.main.empty
|
|
||||||
) {
|
) {
|
||||||
view.dispatch({
|
update.view.dispatch({
|
||||||
effects: textSelectedEffect.of(view),
|
effects: removeReviewPanelTooltipEffect.of(null),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
|
EditorView.domEventHandlers({
|
||||||
mousedown(event, view) {
|
mousedown(event, view) {
|
||||||
view.dispatch({
|
view.dispatch({
|
||||||
effects: removeReviewPanelTooltipEffect.of(null),
|
effects: removeReviewPanelTooltipEffect.of(null),
|
||||||
|
|
Loading…
Reference in a new issue