Thanks for the great tool.
I’m trying to make a plugin with ViewPlugin which can set scrollMargin
to the editor. It should set scrollMargin
to 0 if this.switch
is false, which means user is operating by keyboard.
My code look likes this:
const eventHandlers = {
mousedown(event: MouseEvent, view: EditorView) {
this.switch = false;
},
keydown(event: KeyboardEvent, view: EditorView) {
this.switch = true;
},
}
ViewPlugin.fromClass(class {
switch = true;
margin = {
top: 0,
bottom: 0,
}
// ...
},
{
eventHandlers,
provide: [
PluginField.scrollMargins.from(value => value.margin)
],
})
But I found the key down event will only fire on modifier key in vim normal mode.
Did I miss something? Is there something wrong with my code ? And is there a way to achieve my purpose?