Support setting preventDefault to false in keymapFromSpec spec

This commit is contained in:
Jonatan Heyman 2024-01-05 15:42:11 +01:00
parent 37265d7796
commit 1b0b2d55b1
1 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,11 @@ import { formatBlockContent } from "./block/format-code.js"
export function keymapFromSpec(specs) {
return keymap.of(specs.map((spec) => {
if (spec.run) {
return {...spec, preventDefault: true}
if ("preventDefault" in spec) {
return spec
} else {
return {...spec, preventDefault: true}
}
} else {
const [key, run] = spec
return {