mirror of
https://github.com/heyman/heynote.git
synced 2024-11-22 07:54:11 +01:00
Support setting preventDefault to false in keymapFromSpec spec
This commit is contained in:
parent
37265d7796
commit
1b0b2d55b1
@ -23,7 +23,11 @@ import { formatBlockContent } from "./block/format-code.js"
|
|||||||
export function keymapFromSpec(specs) {
|
export function keymapFromSpec(specs) {
|
||||||
return keymap.of(specs.map((spec) => {
|
return keymap.of(specs.map((spec) => {
|
||||||
if (spec.run) {
|
if (spec.run) {
|
||||||
|
if ("preventDefault" in spec) {
|
||||||
|
return spec
|
||||||
|
} else {
|
||||||
return {...spec, preventDefault: true}
|
return {...spec, preventDefault: true}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const [key, run] = spec
|
const [key, run] = spec
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user