Skip to content

Commit 512a64d

Browse files
committed
Add guards for possible null value in cm.state.vim introduced by codemirror-vim
1 parent f1ed5a8 commit 512a64d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/codemirrorCommands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class VimEditorManager {
9999
// we override `hasFocus` handler to ensure it is taken into account.
100100
const cm = getCM(view)!;
101101
cm.on('vim-mode-change', () => {
102+
if (!cm.state.vim) return;
102103
editor.host.dataset.jpVimModeName = cm.state.vim.mode;
103104
});
104105
mirrorEditor.hasFocus = () => {

src/labCommands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export function addNotebookCommands(
180180
return;
181181
}
182182
const vim = cm.state.vim;
183+
if (!vim) return;
183184

184185
// Get the current editor state
185186
if (

0 commit comments

Comments
 (0)