Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard is not shown when input is read-only, changes in demo and gulpfile #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bower_components
node_modules
dist
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ _Obs.: Required to auto-hide the keyboard interface in mobile devices or to use
<input type='text' ng-model="yourModel" ng-virtual-keyboard/>
```

## Development use

Clone or fork repository, then in parent project directory execute:
```sh
$ npm install
$ gulp default
```

Note: Gulp must be installed globally:
```sh
$ sudo npm install -g gulp
```

## Supported Configurations

### Directive global configurations
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"src",
"demo",
"css",
"gulpfile.js"
"gulpfile.js",
"dist"
],
"dependencies": {},
"devDependencies": {
Expand Down
16 changes: 13 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<title>Angular Virtual Keyboard Demo</title>
<link href="../css/angular-virtual-keyboard.css" rel="stylesheet">
<link href="/css/angular-virtual-keyboard.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.12/angular.min.js"></script>
<script src="../bower_components/angular-useragent-parser/release/angular-useragent-parser.min.js"></script>
<script src="/bower_components/angular-useragent-parser/release/angular-useragent-parser.min.js"></script>

<script src="../release/angular-virtual-keyboard.js"></script>
<script src="/scripts/angular-virtual-keyboard.min.js"></script>

<script>
angular.module('exampleApp', ['angular-useragent-parser', 'angular-virtual-keyboard'])
Expand Down Expand Up @@ -50,6 +50,7 @@
}])
.controller('ExampleCtrl', ['$scope', function($scope){
// Your controller code comes here
$scope.t014rdOnly = true;
}]);
</script>
</head>
Expand All @@ -67,6 +68,15 @@ <h4>Keyboard binded by directive attribute: </h4>
<em>(Model value: {{t02}})</em>
</div>

<h4>Read only field</h4>
<div>
<label>Input text: </label>
<input type='text' ng-model="t014" ng-virtual-keyboard ng-readonly="t014rdOnly"/>
<input type='checkbox' ng-model="t014rdOnly">read-only</input>
<br>
<em>(Model value: {{t014}})</em>
</div>

<br><br>

<h2>Custom configurations</h2>
Expand Down
39 changes: 36 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ var path = {
}
}

var bower = require('gulp-bower');

gulp.task('bower', function() {
return bower();
});

var server = require('gulp-server-livereload');

gulp.task('webserver', function() {
gulp.src('./dist')
.pipe(server({
open: true,
livereload: true
}
));
});

gulp.task('jshint', function(done) {
gulp.src(path.src.files)
.pipe(plugins.jshint('.jshintrc'))
Expand Down Expand Up @@ -48,16 +65,32 @@ gulp.task('build', function() {
.pipe(gulp.dest('./release/'))
.pipe(plugins.uglify())
.pipe(plugins.concat('angular-virtual-keyboard.min.js'))
.pipe(gulp.dest('./release/'));
.pipe(gulp.dest('./release/'))
.pipe(gulp.dest('./dist/scripts'));

gulp.src('./demo/index.html')
.pipe(gulp.dest('./dist/'))

gulp.src('./demo/vki.html')
.pipe(gulp.dest('./dist/'))

gulp.src('./demo/*.png')
.pipe(gulp.dest('./dist/'))

gulp.src('css/angular-virtual-keyboard.css')
.pipe(gulp.dest('./release/'));
.pipe(gulp.dest('./release/'))
.pipe(gulp.dest('./dist/css/'));

gulp.src('bower_components/angular-useragent-parser/release/angular-useragent-parser.min.js')
.pipe(gulp.dest('./dist/bower_components/angular-useragent-parser/release/'))
});

gulp.task('default', ['jshint', 'build'], function() {
gulp.task('default', ['bower', 'jshint', 'build', 'webserver'], function() {
gulp.watch(path.src.files, ['jshint', 'build']);
});



gulp.task('changelog', function(done) {
var pkg = require('./bower.json');
var changelog = require('conventional-changelog');
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
},
"homepage": "https://github.com/the-darc/angular-virtual-keyboard",
"devDependencies": {
"bower": "^1.7.7",
"conventional-changelog": "0.0.16",
"gulp": "^3.8.11",
"gulp-bower": "0.0.13",
"gulp-concat": "^2.5.2",
"gulp-footer": "^1.0.5",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.9.2",
"gulp-load-plugins": "^0.8.0",
"gulp-serve": "^1.2.0",
"gulp-server-livereload": "^1.7.3",
"gulp-uglify": "^1.1.0",
"jshint-stylish": "^1.0.0"
}
Expand Down
3 changes: 2 additions & 1 deletion release/angular-virtual-keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
*
*/
self.attachVki = function(elem) {
if (elem.getAttribute("VKI_attached")) return false;
if (elem.getAttribute("VKI_attached") || elem.readOnly) return false;
if (self.VKI_imageURI) {
var keybut = document.createElement('img');
keybut.src = self.VKI_imageURI;
Expand Down Expand Up @@ -786,6 +786,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
*
*/
this.VKI_show = function(elem) {
if (elem.readOnly) return false;
if (!this.VKI_target) {
this.VKI_target = elem;
if (this.VKI_langAdapt && this.VKI_target.lang) {
Expand Down
2 changes: 1 addition & 1 deletion release/angular-virtual-keyboard.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/vki-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
*
*/
self.attachVki = function(elem) {
if (elem.getAttribute("VKI_attached")) return false;
if (elem.getAttribute("VKI_attached") || elem.readOnly) return false;
if (self.VKI_imageURI) {
var keybut = document.createElement('img');
keybut.src = self.VKI_imageURI;
Expand Down Expand Up @@ -776,6 +776,7 @@ var VKI = function(customConfig, layout, deadKeys, keyInputCallback) {
*
*/
this.VKI_show = function(elem) {
if (elem.readOnly) return false;
if (!this.VKI_target) {
this.VKI_target = elem;
if (this.VKI_langAdapt && this.VKI_target.lang) {
Expand Down