Skip to content

Commit

Permalink
Use event observers in dropCursor and crossHairCursor
Browse files Browse the repository at this point in the history
FIX: Make sure the drop cursor is properly cleaned up even when another extension
handles the drop event.

See https://discuss.codemirror.net/t/how-to-remove-the-dropcursor-programmatically/7086
  • Loading branch information
marijnh committed Sep 12, 2023
1 parent 97502c9 commit 8be0f21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dropcursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const drawDropCursor = ViewPlugin.fromClass(class {
this.view.dispatch({effects: setDropCursorPos.of(pos)})
}
}, {
eventHandlers: {
eventObservers: {
dragover(event) {
this.setDropPos(this.view.posAtCoords({x: event.clientX, y: event.clientY}))
},
Expand Down
2 changes: 1 addition & 1 deletion src/rectangular-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function crosshairCursor(options: {
}
}
}, {
eventHandlers: {
eventObservers: {
keydown(e) {
this.set(e.keyCode == code || getter(e))
},
Expand Down
2 changes: 1 addition & 1 deletion src/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
}
}
}, {
eventHandlers: {
eventObservers: {
scroll() { this.maybeMeasure() }
}
})
Expand Down

0 comments on commit 8be0f21

Please sign in to comment.