mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUACAMOLE-352: Monitor input and composition events to keep input sink contents clear.
This commit is contained in:
@@ -1448,20 +1448,22 @@ Guacamole.Keyboard.InputSink = function InputSink() {
|
|||||||
field.style.left = '-10px';
|
field.style.left = '-10px';
|
||||||
field.style.top = '-10px';
|
field.style.top = '-10px';
|
||||||
|
|
||||||
/**
|
// Keep field clear when modified via normal keypresses
|
||||||
* Clears the contents of the underlying field. The actual clearing of the
|
field.addEventListener("keypress", function clearKeypress(e) {
|
||||||
* field is deferred, occurring asynchronously after the call completes.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
var clear = function clear() {
|
|
||||||
window.setTimeout(function deferClear() {
|
|
||||||
field.value = '';
|
field.value = '';
|
||||||
}, 0);
|
}, false);
|
||||||
};
|
|
||||||
|
|
||||||
// Keep internal field contents clear
|
// Keep field clear when modofied via composition events
|
||||||
field.addEventListener("change", clear, false);
|
field.addEventListener("compositionend", function clearCompletedComposition(e) {
|
||||||
|
if (e.data)
|
||||||
|
field.value = '';
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
// Keep field clear when modofied via input events
|
||||||
|
field.addEventListener("input", function clearCompletedInput(e) {
|
||||||
|
if (e.data && !e.isComposing)
|
||||||
|
field.value = '';
|
||||||
|
}, false);
|
||||||
|
|
||||||
// Whenever focus is gained, automatically click to ensure cursor is
|
// Whenever focus is gained, automatically click to ensure cursor is
|
||||||
// actually placed within the field (the field may simply be highlighted or
|
// actually placed within the field (the field may simply be highlighted or
|
||||||
|
Reference in New Issue
Block a user