You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/16 18:42:08 UTC
[22/23] guacamole-client git commit: GUACAMOLE-352: Monitor input and
composition events to keep input sink contents clear.
GUACAMOLE-352: Monitor input and composition events to keep input sink contents clear.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/376c4380
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/376c4380
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/376c4380
Branch: refs/heads/master
Commit: 376c4380d5fc7bb61134b0a513d52b101b7bee4c
Parents: d8de3a7
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Dec 18 16:29:54 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Jan 16 10:20:43 2018 -0800
----------------------------------------------------------------------
.../src/main/webapp/modules/Keyboard.js | 26 +++++++++++---------
1 file changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/376c4380/guacamole-common-js/src/main/webapp/modules/Keyboard.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
index 61889c1..6874e0a 100644
--- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js
+++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
@@ -1448,20 +1448,22 @@ Guacamole.Keyboard.InputSink = function InputSink() {
field.style.left = '-10px';
field.style.top = '-10px';
- /**
- * Clears the contents of the underlying field. The actual clearing of the
- * field is deferred, occurring asynchronously after the call completes.
- *
- * @private
- */
- var clear = function clear() {
- window.setTimeout(function deferClear() {
+ // Keep field clear when modified via normal keypresses
+ field.addEventListener("keypress", function clearKeypress(e) {
+ field.value = '';
+ }, false);
+
+ // Keep field clear when modofied via composition events
+ field.addEventListener("compositionend", function clearCompletedComposition(e) {
+ if (e.data)
field.value = '';
- }, 0);
- };
+ }, false);
- // Keep internal field contents clear
- field.addEventListener("change", clear, 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
// actually placed within the field (the field may simply be highlighted or