Commit ecf7c612ab6cf64da5bb41173a4b9a0704d1a50a

Authored by Jose Pinto
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Agrego boton enter

See merge request !1
... ... @@ -8,7 +8,7 @@
8 8 "compile": "gulp uglify",
9 9 "gulp-pre-commit": "gulp pre-commit",
10 10 "postinstall": "npm run compile && gulp clean-post-install",
11   - "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es jasmine-core jquery jshint pre-commit pump && npm install angular-sanitize git+https://github.com/ericf97/angular-on-screen-keyboard.git"
  11 + "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-sass jasmine-core jquery jshint pre-commit pump && npm install angular-sanitize git+https://github.com/ericf97/angular-on-screen-keyboard.git"
12 12 },
13 13 "pre-commit": [
14 14 "gulp-pre-commit"
... ... @@ -34,26 +34,29 @@
34 34 "pump": "^3.0.x"
35 35 },
36 36 "devDependencies": {
37   - "angular": "^1.7.5",
  37 + "angular": "1.7.5",
38 38 "angular-route": "^1.7.5",
39   - "angular-sanitize": "^1.7.5",
40   - "bootstrap": "^4.1.3",
41   - "font-awesome": "^4.7.0",
42   - "gulp": "^3.9.1",
43   - "gulp-angular-templatecache": "^2.2.2",
44   - "gulp-clean": "^0.4.0",
45   - "gulp-concat": "^2.6.1",
46   - "gulp-connect": "^5.6.1",
47   - "gulp-htmlmin": "^5.0.1",
48   - "gulp-jshint": "^2.1.0",
49   - "gulp-rename": "^1.4.0",
50   - "gulp-replace": "^1.0.0",
51   - "gulp-sass": "^4.0.2",
52   - "gulp-uglify-es": "^1.0.4",
53   - "jasmine-core": "^3.2.1",
54   - "jquery": "^3.3.1",
55   - "jshint": "^2.9.6",
56   - "pre-commit": "^1.2.2",
57   - "pump": "^3.0.0"
  39 + "angular-sanitize": "1.7.5",
  40 + "bootstrap": "4.1.3",
  41 + "font-awesome": "4.7.0",
  42 + "gulp": "3.9.1",
  43 + "gulp-angular-templatecache": "2.2.5",
  44 + "gulp-clean": "0.4.0",
  45 + "gulp-concat": "2.6.1",
  46 + "gulp-connect": "5.6.1",
  47 + "gulp-htmlmin": "5.0.1",
  48 + "gulp-jshint": "2.1.0",
  49 + "gulp-rename": "1.4.0",
  50 + "gulp-replace": "1.0.0",
  51 + "gulp-sass": "4.0.2",
  52 + "gulp-uglify-es": "1.0.4",
  53 + "jasmine-core": "3.3.0",
  54 + "jquery": "3.3.1",
  55 + "jshint": "2.9.6",
  56 + "pre-commit": "1.2.2",
  57 + "pump": "3.0.0"
  58 + },
  59 + "dependencies": {
  60 + "angular-on-screen-keyboard": "git+https://github.com/ericf97/angular-on-screen-keyboard.git"
58 61 }
59 62 }
src/js/angular-on-screen-keyboard-directive.js
... ... @@ -84,6 +84,9 @@ angular.module('onScreenKeyboard', ['ngSanitize'])
84 84 } else if (key.type === 'shift') {
85 85 ctrl.isUpperCase = !ctrl.isUpperCase;
86 86 return;
  87 + } else if (key.type === 'enter') {
  88 + ctrl.pressEnterKey();
  89 + return;
87 90 }
88 91  
89 92 var htmlKeyVal = angular.element(event.target || event.srcElement).text();
... ... @@ -171,6 +174,42 @@ angular.module('onScreenKeyboard', ['ngSanitize'])
171 174 }
172 175 };
173 176  
  177 + ctrl.pressEnterKey = function() {
  178 +
  179 + $timeout(function() {
  180 + if (angular.element(':focus').length > 0) {
  181 +
  182 + var el = angular.element(':focus')[0],
  183 + down = new KeyboardEvent('keydown',
  184 + {
  185 + which: 13,
  186 + keyCode: 13,
  187 + bubbles: true,
  188 + cancelable: true,
  189 + }),
  190 + press = new KeyboardEvent('keypress',
  191 + {
  192 + which: 13,
  193 + keyCode: 13,
  194 + bubbles: true,
  195 + cancelable: true,
  196 + }),
  197 + up = new KeyboardEvent('keyup',
  198 + {
  199 + which: 13,
  200 + keyCode: 13,
  201 + bubbles: true,
  202 + cancelable: true,
  203 + });
  204 +
  205 + el.dispatchEvent(down);
  206 + el.dispatchEvent(press);
  207 + el.dispatchEvent(up);
  208 + }
  209 + });
  210 +
  211 + };
  212 +
174 213 var focusin = function(event) {
175 214 var e = event.target || event.srcElement;
176 215  
src/js/controller.js
... ... @@ -7,11 +7,12 @@ angular.module('focaTeclado')
7 7 ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
8 8 ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ñ'],
9 9 ['z', 'x', 'c', 'v', 'b', 'n', 'm',
10   - {type: 'erase', colspan: 3, text: 'spr'}
  10 + {type: 'erase', colspan: 3, text: 'Del'}
11 11 ],
12 12 [
13 13 {type: 'margin', colspan: 1},
14   - {type: 'button', colspan: 6, text: ' '}
  14 + {type: 'button', colspan: 6, text: ' '},
  15 + {type: 'enter', colspan: 3, text: 'Enter'}
15 16 ]
16 17 ];
17 18