fix(interaction): problem with entering to Editor.js by Tab key (#1397)

* Fix problem with entering to Editor.js by Tab key
* Optimize current block setting

Co-authored-by: t.hata <hata@impact-blue.co.jp>
This commit is contained in:
Tomoyuki Hata 2020-11-19 21:55:26 +09:00 committed by GitHub
parent b134fccd1d
commit 113e895d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

2
dist/editor.js vendored

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
- `Fix` - The problem with destroy() method [#1380](https://github.com/codex-team/editor.js/issues/1380).
- `Fix` - add getter keyword to `block.mergeable` method [#1415](https://github.com/codex-team/editor.js/issues/1415).
- `Fix` — Fix problem with entering to Editor.js by Tab key [#1393](https://github.com/codex-team/editor.js/issues/1393)
### 2.19

View file

@ -726,7 +726,7 @@ export default class UI extends Module<UINodes> {
*/
private selectionChanged(event: Event): void {
const { CrossBlockSelection, BlockSelection } = this.Editor;
const focusedElement = Selection.anchorElement as Element;
const focusedElement = Selection.anchorElement;
if (CrossBlockSelection.isCrossBlockSelectionStarted) {
// Removes all ranges when any Block is selected
@ -750,6 +750,13 @@ export default class UI extends Module<UINodes> {
return;
}
/**
* Set current block when entering to Editor.js by tab key
*/
if (!this.Editor.BlockManager.currentBlock) {
this.Editor.BlockManager.setCurrentBlockByChildNode(focusedElement);
}
/**
* @todo add debounce
*/