1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { KeystrokeHandler, type PriorityString } from '@ckeditor/ckeditor5-utils';
|
9 | import type Editor from './editor/editor.js';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export default class EditingKeystrokeHandler extends KeystrokeHandler {
|
24 | |
25 |
|
26 |
|
27 | readonly editor: Editor;
|
28 | |
29 |
|
30 |
|
31 | constructor(editor: Editor);
|
32 | /**
|
33 | * Registers a handler for the specified keystroke.
|
34 | *
|
35 | * The handler can be specified as a command name or a callback.
|
36 | *
|
37 | * @param keystroke Keystroke defined in a format accepted by
|
38 | * the {@link module:utils/keyboard~parseKeystroke} function.
|
39 | * @param callback If a string is passed, then the keystroke will
|
40 | * {@link module:core/editor/editor~Editor#execute execute a command}.
|
41 | * If a function, then it will be called with the
|
42 | * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
|
43 | * a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.
|
44 | * @param options Additional options.
|
45 | * @param options.priority The priority of the keystroke callback. The higher the priority value
|
46 | * the sooner the callback will be executed. Keystrokes having the same priority
|
47 | * are called in the order they were added.
|
48 | */
|
49 | set(keystroke: string | Array<string | number>, callback: EditingKeystrokeCallback, options?: {
|
50 | readonly priority?: PriorityString;
|
51 | }): void;
|
52 | }
|
53 |
|
54 |
|
55 |
|
56 | export type EditingKeystrokeCallback = string | ((ev: KeyboardEvent, cancel: () => void) => void);
|
57 |
|
\ | No newline at end of file |