I am trying to set my custom keymap to codemirror editor cells from my extension.
this.tracker.activeCellChanged.connect(this.onActiveCellChanged, this);
I’m connecting the following function to activeCellChanged
event of INotebookTracker
:
private onActiveCellChanged(): void {
if (this.tracker.activeCell !== null) {
const view = (this.tracker.activeCell.editor as CodeMirrorEditor).editor;
const transaction = view.state.update({
effects: StateEffect.reconfigure.of(keymap.of(myKeymap))
})
view.dispatch(transaction);
}
}
Following Codemirror 6 style, I’m creating a transaction to reconfigure editor config and then applying it.
And it actually works, I can now use my keybindings in cells. However it breaks something and output is not updating on new executions.
Either this is a bug, or (most likely) I’m doing something wrong.
Isn’t it a correct way to change a keymap?
Jupyterlab 4.0.5, Windows 11.