Skip to content

Commit 1cc93d9

Browse files
Dominator008marijnh
authored andcommitted
[vim bindings] Check if cm.save() is available before saving
cm.save() might not exist if CodeMirror is not created from a textarea. This adds an additional check to prevent TypeErrors.
1 parent 65964cf commit 1cc93d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

keymap/vim.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4515,8 +4515,8 @@
45154515
if (CodeMirror.commands.save) {
45164516
// If a save command is defined, call it.
45174517
CodeMirror.commands.save(cm);
4518-
} else {
4519-
// Saves to text area if no save command is defined.
4518+
} else if (cm.save) {
4519+
// Saves to text area if no save command is defined and cm.save() is available.
45204520
cm.save();
45214521
}
45224522
},

0 commit comments

Comments
 (0)