mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-810: Inform text input UI when focus is needed.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
<!-- Text input -->
|
||||
<div class="text-input-container" ng-show="showTextInput">
|
||||
<guac-text-input></guac-text-input>
|
||||
<guac-text-input needs-focus="showTextInput"></guac-text-input>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@@ -28,7 +28,17 @@ angular.module('textInput').directive('guacTextInput', [function guacTextInput()
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {},
|
||||
scope: {
|
||||
|
||||
/**
|
||||
* Whether the text input UI should have focus. Setting this value
|
||||
* is not guaranteed to work, due to browser limitations.
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
needsFocus : '=?'
|
||||
|
||||
},
|
||||
|
||||
templateUrl: 'app/textInput/templates/guacTextInput.html',
|
||||
controller: ['$scope', '$rootScope', '$element', '$timeout',
|
||||
@@ -324,6 +334,16 @@ angular.module('textInput').directive('guacTextInput', [function guacTextInput()
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
|
||||
// Attempt to change focus depending on need
|
||||
$scope.$watch('needsFocus', function focusDesireChanged(focusNeeded) {
|
||||
|
||||
if (focusNeeded)
|
||||
target.focus();
|
||||
else
|
||||
target.blur();
|
||||
|
||||
});
|
||||
|
||||
// If the text input UI has focus, prevent keydown events
|
||||
$scope.$on('guacBeforeKeydown', function filterKeydown(event, keysym) {
|
||||
if (hasFocus && !ALLOWED_KEYS[keysym])
|
||||
|
Reference in New Issue
Block a user