Use activeElement if anchorNode is undefined (#1350)

This commit is contained in:
George Berezhnoy 2020-10-07 21:32:57 +03:00 committed by GitHub
commit 962d75abf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

2
dist/editor.js vendored

File diff suppressed because one or more lines are too long

View file

@ -632,8 +632,12 @@ export default class Block {
/**
* If activeElement is native input, anchorNode points to its parent.
* So if it is native input use it instead of anchorNode
*
* If anchorNode is undefined, also use activeElement
*/
this.currentInput = $.isNativeInput(document.activeElement) ? document.activeElement : SelectionUtils.anchorNode;
this.currentInput = $.isNativeInput(document.activeElement) || !SelectionUtils.anchorNode
? document.activeElement
: SelectionUtils.anchorNode;
}
/**