remoteview
Version:
Remote isolated browser platform by Dosyago
29 lines (27 loc) • 905 B
JavaScript
export function handleKeysCanInputMessage({keyInput:{
keysCanInput,
isTextareaOrContenteditable, type, inputmode,
value:value = ''
}, executionContextId}, state) {
if ( state.ignoreKeysCanInputMessage ) return;
if ( keysCanInput ) {
state.contextIdOfFocusedInput = executionContextId;
if ( ! state.dontFocusControlInputs ) {
if ( isTextareaOrContenteditable ) {
state.viewState.focusTextarea(inputmode, value);
} else {
state.viewState.focusKeyinput(type, inputmode, value);
}
}
} else {
state.contextIdOfFocusedInput = null;
if ( ! state.dontFocusControlInputs ) {
const active = document.activeElement;
if ( active == state.viewState.textarea ) {
state.viewState.blurTextarea();
} else if ( active == state.viewState.keyinput ) {
state.viewState.blurKeyinput();
}
}
}
}