mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Move selection into editable, if it's not there after focus
This commit is contained in:
parent
c01c4b642b
commit
d11d66ee79
1 changed files with 6 additions and 0 deletions
|
@ -10,6 +10,12 @@ import { bridgeCommand } from "./lib";
|
|||
export function onFocus(evt: FocusEvent): void {
|
||||
const currentField = evt.currentTarget as EditingArea;
|
||||
currentField.focus();
|
||||
|
||||
if (currentField.shadowRoot!.getSelection()!.anchorNode === null) {
|
||||
// selection is not inside editable after focusing
|
||||
currentField.caretToEnd();
|
||||
}
|
||||
|
||||
bridgeCommand(`focus:${currentField.ord}`);
|
||||
enableButtons();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue