|
1 | 1 | import {setBlockType} from 'prosemirror-commands'; |
2 | 2 | import type {Action, ExtensionAuto, Keymap} from '../../../core'; |
| 3 | +import {withLogAction} from '../../../utils/keymap'; |
3 | 4 | import {headingAction} from './actions'; |
4 | 5 | import {HeadingAction, HeadingLevel, headingLevelAttr} from './const'; |
5 | 6 | import {headingRule, hType} from './utils'; |
@@ -29,12 +30,12 @@ export const Heading: ExtensionAuto<HeadingOptions> = (builder, opts) => { |
29 | 30 | setBlockType(hType(schema), {[headingLevelAttr]: level}); |
30 | 31 |
|
31 | 32 | const bindings: Keymap = {Backspace: resetHeading}; |
32 | | - if (h1Key) bindings[h1Key] = cmd4lvl(1); |
33 | | - if (h2Key) bindings[h2Key] = cmd4lvl(2); |
34 | | - if (h3Key) bindings[h3Key] = cmd4lvl(3); |
35 | | - if (h4Key) bindings[h4Key] = cmd4lvl(4); |
36 | | - if (h5Key) bindings[h5Key] = cmd4lvl(5); |
37 | | - if (h6Key) bindings[h6Key] = cmd4lvl(6); |
| 33 | + if (h1Key) bindings[h1Key] = withLogAction('heading1', cmd4lvl(1)); |
| 34 | + if (h2Key) bindings[h2Key] = withLogAction('heading2', cmd4lvl(2)); |
| 35 | + if (h3Key) bindings[h3Key] = withLogAction('heading3', cmd4lvl(3)); |
| 36 | + if (h4Key) bindings[h4Key] = withLogAction('heading4', cmd4lvl(4)); |
| 37 | + if (h5Key) bindings[h5Key] = withLogAction('heading5', cmd4lvl(5)); |
| 38 | + if (h6Key) bindings[h6Key] = withLogAction('heading6', cmd4lvl(6)); |
38 | 39 | return bindings; |
39 | 40 | }) |
40 | 41 | .addInputRules(({schema}) => ({rules: [headingRule(hType(schema), 6)]})); |
|
0 commit comments