Skip to content

Commit cfa01fa

Browse files
committed
Merge branch 'release/0.4.3'
2 parents 1abcf24 + b4dafe3 commit cfa01fa

File tree

8 files changed

+67
-15
lines changed

8 files changed

+67
-15
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
<a name"0.4.3"></a>
2+
### 0.4.3 (2015-11-19)
3+
4+
5+
#### Bug Fixes
6+
7+
* **VKI_insert:** trim button text before insert in the input field ([52956b40](https://github.com/the-darc/angular-virtual-keyboard/commit/52956b40))
8+
* **bower:** include css in main section of bower ([05e9899](https://github.com/the-darc/angular-virtual-keyboard/commit/05e9899))
9+
* **UAParser:** Windows Phone added to supported mobile platforms ([9143622](https://github.com/the-darc/angular-virtual-keyboard/commit/9143622))
10+
11+
#### Features
12+
13+
* **custom-class:** add support to custom-class configuration ([b2477cd5](https://github.com/the-darc/angular-virtual-keyboard/commit/b2477cd5))
14+
15+
116
<a name"0.4.2"></a>
217
### 0.4.2 (2015-07-21)
318

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
[![Bower version](https://badge.fury.io/bo/angular-virtual-keyboard.svg)](http://badge.fury.io/bo/angular-virtual-keyboard)
21
angular-virtual-keyboard
32
========================
3+
[![npm version](https://badge.fury.io/js/angular-virtual-keyboard.svg)](http://badge.fury.io/js/angular-virtual-keyboard)
4+
[![Bower version](https://badge.fury.io/bo/angular-virtual-keyboard.svg)](http://badge.fury.io/bo/angular-virtual-keyboard)
5+
46
An AngularJs Virtual Keyboard Interface based on [GreyWyvern VKI](http://www.greywyvern.com/code/javascript/keyboard). See example in the [Demo page](http://the-darc.github.io/angular-virtual-keyboard).
57

68
![Demo image](http://the-darc.github.io/angular-virtual-keyboard/images/demo.png)
79

8-
## Bower install
10+
## Install
11+
12+
### With bower
913

1014
```sh
1115
$ bower install angular-virtual-keyboard
1216
```
1317

18+
### With npm
19+
20+
```sh
21+
$ npm install angular-virtual-keyboard
22+
```
23+
1424
## Dependencies
1525

16-
- Optional: [angular-useragent-parser](https://github.com/the-darc/angular-useragent-parser)
26+
- Optional: [angular-useragent-parser](https://github.com/the-darc/angular-useragent-parser)
1727
_Obs.: Required to auto-hide the keyboard interface in mobile devices or to use the 'vk-force-mobile' configuration._
1828

1929
## Usage
@@ -36,12 +46,13 @@ _Obs.: Required to auto-hide the keyboard interface in mobile devices or to use
3646

3747
The angular-virtual-keyboard module use an [Angular.js Constant](https://docs.angularjs.org/api/auto/service/$provide#constant) named ``VKI_CONFIG`` to handle the configurations that will be applied to all instances of the ``ng-virtual-keyboard`` directive. See list below:
3848

39-
- __Keyboard layouts configurations__ ``VKI_CONFIG.layout`` Array of Keyboard Layout configurations. See [vki-layouts.js](https://github.com/the-darc/angular-virtual-keyboard/blob/master/src/vki-layouts.js) for keyboard layout configuration examples.
40-
- __Deadkeys configurations__ ``VKI_CONFIG.deadkey`` Array of Deadkeys configurations. See [vki-deadkeys.js](https://github.com/the-darc/angular-virtual-keyboard/blob/master/src/vki-deadkeys.js) for deadkeys configuration examples.
49+
- __Keyboard layouts configurations__ ``VKI_CONFIG.layout`` Array of Keyboard Layout configurations. See [vki-layouts.js](https://github.com/the-darc/angular-virtual-keyboard/blob/master/src/vki-layouts.js) for keyboard layout configuration examples.
50+
- __Deadkeys configurations__ ``VKI_CONFIG.deadkey`` Array of Deadkeys configurations. See [vki-deadkeys.js](https://github.com/the-darc/angular-virtual-keyboard/blob/master/src/vki-deadkeys.js) for deadkeys configuration examples.
4151
- __Default keyboard layout__ ``VKI_CONFIG.kt`` Name of the layout configuration to be used as default (if no specific layout configuration is provided in the directive instance configuration). _Default: 'US International'_
4252
- __Relative position__ ``VKI_CONFIG.relative`` Use ``true`` to position the keyboard next to the input, ``false`` to place in the bottom of page. _Default: ``true``_
4353
- __Adjust keyboard size__ ``VKI_CONFIG.sizeAdj`` Allow user to adjust keyboard size. _Default: ``true``_
44-
- __i18n configuration__ ``VKI_CONFIG.i18n`` An array to replace the default labels of the keyboard interface. See example below:
54+
- __i18n configuration__ ``VKI_CONFIG.i18n`` An array to replace the default labels of the keyboard interface. See example below:
55+
- __Custom CSS Class__ ``VKI_CONFIG.customClass`` A CSS class name to add in the first html element of the keyboard
4556
```javascript
4657
VKI_CONFIG.i18n = {
4758
'00': "Exibir teclado numérico",
@@ -74,6 +85,7 @@ The ``ng-virtual-keyboard`` could receive an array with the configurations that
7485
- __Relative position__ ``relative`` Use ``true`` to position the keyboard next to the input, and ``false`` to place in the bottom of page. _Default: ``true``_
7586
- __Keyboard size control__ ``size`` Five sizes based on font-size have been pre-programmed: 13px, 16px (default), 20px, 24px and 28px; corresponding to the sizes 1 to 5 respectively. _Default: 3_
7687
- __Adjust keyboard size__ ``sizeAdj`` Allow user to adjust keyboard size. _Default: ``true``_
88+
- __Custom CSS Class__ ``customClass`` A CSS class name to add in the first html element of the keyboard
7789

7890
### Example of use
7991

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-virtual-keyboard",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"homepage": "https://github.com/the-darc/angular-virtual-keyboard",
55
"author": "the-darc <[email protected]>",
66
"description": "An AngularJs Virtual Keyboard Interface based on GreyWyvern VKI",

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-virtual-keyboard",
3-
"version": "0.4.2",
4-
"description": "",
3+
"version": "0.4.3",
4+
"description": "An AngularJs Virtual Keyboard Interface based on GreyWyvern VKI",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
@@ -12,6 +12,11 @@
1212
},
1313
"author": "the-darc <[email protected]>",
1414
"license": "MIT",
15+
"keywords": [
16+
"Keyboard",
17+
"Virtual",
18+
"VKI"
19+
],
1520
"bugs": {
1621
"url": "https://github.com/the-darc/angular-virtual-keyboard/issues"
1722
},

release/angular-virtual-keyboard.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* angular-virtual-keyboard
33
* An AngularJs Virtual Keyboard Interface based on GreyWyvern VKI
4-
* @version v0.4.2
4+
* @version v0.4.3
55
* @author the-darc <[email protected]>
66
* @link https://github.com/the-darc/angular-virtual-keyboard
77
* @license MIT
@@ -87,6 +87,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
8787
this.VKI_keyCenter = config.keyCenter || 3;
8888
this.VKI_forcePosition = config.forcePosition || false;
8989
this.VKI_relative = config.relative === false ? false : true;
90+
this.VKI_customClass = config.customClass || false;
9091

9192
this.VKI_isIE = /*@cc_on!@*/false;
9293
this.VKI_isIE6 = /*@if(@_jscript_version == 5.6)!@end@*/false;
@@ -289,6 +290,9 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
289290
if (this.VKI_relative) {
290291
self.VKI_keyboard.className += ' relativeKeyboard';
291292
}
293+
if (this.VKI_customClass) {
294+
self.VKI_keyboard.className += ' ' + this.VKI_customClass;
295+
}
292296
this.VKI_keyboard.dir = "ltr";
293297
this.VKI_keyboard.cellSpacing = "0";
294298
this.VKI_keyboard.reflow = function() {
@@ -748,6 +752,9 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
748752
*/
749753
this.VKI_insert = function(text) {
750754
this.VKI_target.focus();
755+
if (text && text.length > 1 && text.trim) {
756+
text = text.trim();
757+
}
751758
if (this.VKI_target.maxLength) this.VKI_target.maxlength = this.VKI_target.maxLength;
752759
if (typeof this.VKI_target.maxlength == "undefined" ||
753760
this.VKI_target.maxlength < 0 ||
@@ -1062,7 +1069,8 @@ angular.module('angular-virtual-keyboard', [])
10621069
'11': 'Increase keyboard size'
10631070
},
10641071
relative: true,
1065-
sizeAdj: true
1072+
sizeAdj: true,
1073+
customClass: false
10661074
})
10671075
.service('ngVirtualKeyboardService', ['VKI_CONFIG', function(VKI_CONFIG) {
10681076
/*globals VKI */
@@ -1074,6 +1082,7 @@ angular.module('angular-virtual-keyboard', [])
10741082
config.relative = config.relative === false ? false : VKI_CONFIG.relative;
10751083
config.keyCenter = config.keyCenter || VKI_CONFIG.keyCenter;
10761084
config.sizeAdj = config.sizeAdj === false ? false : VKI_CONFIG.sizeAdj;
1085+
config.customClass = config.customClass || VKI_CONFIG.customClass;
10771086

10781087
var vki = new VKI(config, VKI_CONFIG.layout, VKI_CONFIG.deadkey, inputCallback);
10791088
vki.attachVki(element);
@@ -1098,8 +1107,10 @@ angular.module('angular-virtual-keyboard', [])
10981107
var UAParser = $injector.get('UAParser');
10991108
var results = new UAParser().getResult();
11001109
var isMobile = results.device.type === 'mobile' || results.device.type === 'tablet';
1101-
isMobile = isMobile || (results.os && (results.os.name === 'Android'));
1102-
isMobile = isMobile || (results.os && (results.os.name === 'iOS'));
1110+
isMobile = isMobile || (results.os && (results.os.name === 'Android'));
1111+
isMobile = isMobile || (results.os && (results.os.name === 'iOS'));
1112+
isMobile = isMobile || (results.os && (results.os.name === 'Windows Phone'));
1113+
isMobile = isMobile || (results.os && (results.os.name === 'Windows Mobile'));
11031114
if (isMobile && scope.config.showInMobile !== true) {
11041115
return;
11051116
}

release/angular-virtual-keyboard.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-virtual-keyboard.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ angular.module('angular-virtual-keyboard', [])
6161
'11': 'Increase keyboard size'
6262
},
6363
relative: true,
64-
sizeAdj: true
64+
sizeAdj: true,
65+
customClass: false
6566
})
6667
.service('ngVirtualKeyboardService', ['VKI_CONFIG', function(VKI_CONFIG) {
6768
/*globals VKI */
@@ -73,6 +74,7 @@ angular.module('angular-virtual-keyboard', [])
7374
config.relative = config.relative === false ? false : VKI_CONFIG.relative;
7475
config.keyCenter = config.keyCenter || VKI_CONFIG.keyCenter;
7576
config.sizeAdj = config.sizeAdj === false ? false : VKI_CONFIG.sizeAdj;
77+
config.customClass = config.customClass || VKI_CONFIG.customClass;
7678

7779
var vki = new VKI(config, VKI_CONFIG.layout, VKI_CONFIG.deadkey, inputCallback);
7880
vki.attachVki(element);

src/vki-core.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
7777
this.VKI_keyCenter = config.keyCenter || 3;
7878
this.VKI_forcePosition = config.forcePosition || false;
7979
this.VKI_relative = config.relative === false ? false : true;
80+
this.VKI_customClass = config.customClass || false;
8081

8182
this.VKI_isIE = /*@cc_on!@*/false;
8283
this.VKI_isIE6 = /*@if(@_jscript_version == 5.6)!@end@*/false;
@@ -279,6 +280,9 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
279280
if (this.VKI_relative) {
280281
self.VKI_keyboard.className += ' relativeKeyboard';
281282
}
283+
if (this.VKI_customClass) {
284+
self.VKI_keyboard.className += ' ' + this.VKI_customClass;
285+
}
282286
this.VKI_keyboard.dir = "ltr";
283287
this.VKI_keyboard.cellSpacing = "0";
284288
this.VKI_keyboard.reflow = function() {
@@ -738,6 +742,9 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
738742
*/
739743
this.VKI_insert = function(text) {
740744
this.VKI_target.focus();
745+
if (text && text.length > 1 && text.trim) {
746+
text = text.trim();
747+
}
741748
if (this.VKI_target.maxLength) this.VKI_target.maxlength = this.VKI_target.maxLength;
742749
if (typeof this.VKI_target.maxlength == "undefined" ||
743750
this.VKI_target.maxlength < 0 ||

0 commit comments

Comments
 (0)