Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 ca3567929 -> 471414788
IGNITE-843 Fixed Ctrl+A/C/V handling in inputs with typeahead. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/47141478 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/47141478 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/47141478 Branch: refs/heads/ignite-843 Commit: 471414788daffe2e8592320dc8ff6738d3774f64 Parents: ca35679 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Aug 7 10:49:50 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Aug 7 10:49:50 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/common-module.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/47141478/modules/control-center-web/src/main/js/controllers/common-module.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js index 96947dd..6015cc5 100644 --- a/modules/control-center-web/src/main/js/controllers/common-module.js +++ b/modules/control-center-web/src/main/js/controllers/common-module.js @@ -507,29 +507,33 @@ controlCenterModule.directive('onEscape', function () { // Directive to retain selection. To fix angular-strap typeahead bug with setting cursor to the end of text. controlCenterModule.directive('retainSelection', function ($timeout) { return function (scope, elem, attr) { - elem.on('keydown', function (event) { - var key = event.which; + elem.on('keydown', function (evt) { + var key = evt.which; + var ctrlDown = evt.ctrlKey || evt.metaKey; var input = this; var start = input.selectionStart; $timeout(function() { var setCursor = false; - // Handle Backspace. + // Handle Backspace[8]. if (key == 8 && start > 0) { start -= 1; setCursor = true; } - // Handle Del. + // Handle Del[46]. else if (key == 46) setCursor = true; - // Handle: Caps Lock, Tab, Shift, Ctrl, Alt, Esc, Enter, Arrows, Home, End, PgUp, PgDown, F1..F12, Num Lock, Scroll Lock. + // Handle: Caps Lock[20], Tab[9], Shift[16], Ctrl[17], Alt[18], Esc[27], Enter[13], Arrows[37..40], Home[36], End[35], Ins[45], PgUp[33], PgDown[34], F1..F12[111..124], Num Lock[], Scroll Lock[145]. else if (!(key == 9 || key == 13 || (key > 15 && key < 20) || key == 27 || - (key > 32 && key < 41) || (key > 111 && key < 124) || key == 144 || key == 145)) { - start += 1; + (key > 32 && key < 41) || key == 45 || (key > 111 && key < 124) || key == 144 || key == 145)) { + // Handle: Ctrl + [A[65], C[67], V[86]]. + if (!(ctrlDown && (key = 65 || key == 67 || key == 86))) { + start += 1; - setCursor = true; + setCursor = true; + } } if (setCursor)