* Ignore all other document's keydown events * * @param {KeyboardEvent} event - keyboard event
(event: KeyboardEvent)
| 503 | * @param {KeyboardEvent} event - keyboard event |
| 504 | */ |
| 505 | private defaultBehaviour(event: KeyboardEvent): void { |
| 506 | const { currentBlock } = this.Editor.BlockManager; |
| 507 | const keyDownOnEditor = (event.target as HTMLElement).closest(`.${this.CSS.editorWrapper}`); |
| 508 | const isMetaKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; |
| 509 | |
| 510 | /** |
| 511 | * When some block is selected, but the caret is not set inside the editor, treat such keydowns as keydown on selected block. |
| 512 | */ |
| 513 | if (currentBlock !== undefined && keyDownOnEditor === null) { |
| 514 | this.Editor.BlockEvents.keydown(event); |
| 515 | |
| 516 | return; |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * Ignore keydowns on editor and meta keys |
| 521 | */ |
| 522 | if (keyDownOnEditor || (currentBlock && isMetaKey)) { |
| 523 | return; |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Remove all highlights and remove caret |
| 528 | */ |
| 529 | this.Editor.BlockManager.unsetCurrentBlock(); |
| 530 | |
| 531 | /** |
| 532 | * Close Toolbar |
| 533 | */ |
| 534 | this.Editor.Toolbar.close(); |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * @param {KeyboardEvent} event - keyboard event |
no test coverage detected