Compare commits

...

10 Commits

Author SHA1 Message Date
Francisco Hodge
de2100cb7b npm update 2019-06-05 21:09:14 -04:00
Francisco Hodge
04a3c186f0 Added disableButtonHold option 2019-06-05 21:08:53 -04:00
dependabot-preview[bot]
5fa612a923 Merge pull request #99 from hodgef/dependabot/npm_and_yarn/webpack-4.33.0 2019-06-05 13:15:09 +00:00
dependabot-preview[bot]
9a34b6eb37 Merge pull request #97 from hodgef/dependabot/npm_and_yarn/resolve-1.11.1 2019-06-05 13:14:41 +00:00
dependabot-preview[bot]
66fa632ca4 Bump resolve from 1.11.0 to 1.11.1
Bumps [resolve](https://github.com/browserify/resolve) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/browserify/resolve/releases)
- [Commits](https://github.com/browserify/resolve/compare/v1.11.0...v1.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-05 13:08:22 +00:00
dependabot-preview[bot]
51d6d66fc6 Bump webpack from 4.32.2 to 4.33.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.32.2 to 4.33.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.32.2...v4.33.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-05 13:08:19 +00:00
dependabot-preview[bot]
84d2c45887 Merge pull request #98 from hodgef/dependabot/npm_and_yarn/webpack-dev-server-3.5.1 2019-06-05 13:05:48 +00:00
dependabot-preview[bot]
966bfd47db Merge pull request #96 from hodgef/dependabot/npm_and_yarn/postcss-normalize-8.0.0 2019-06-05 12:58:38 +00:00
dependabot-preview[bot]
02d88bae10 Bump webpack-dev-server from 3.5.0 to 3.5.1
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-05 12:57:16 +00:00
dependabot-preview[bot]
6802c1f9dc Bump postcss-normalize from 7.0.1 to 8.0.0
Bumps [postcss-normalize](https://github.com/csstools/postcss-normalize) from 7.0.1 to 8.0.0.
- [Release notes](https://github.com/csstools/postcss-normalize/releases)
- [Changelog](https://github.com/csstools/postcss-normalize/blob/master/CHANGELOG.md)
- [Commits](https://github.com/csstools/postcss-normalize/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-05 12:55:34 +00:00
6 changed files with 1131 additions and 5304 deletions

View File

@@ -1,6 +1,6 @@
language: node_js
node_js:
- '11.2'
- node
install:
- npm install -g codecov
- npm install

6375
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "simple-keyboard",
"version": "2.22.0",
"version": "2.23.0",
"description": "On-screen Javascript Virtual Keyboard",
"main": "build/index.js",
"types": "build/index.d.ts",
@@ -80,7 +80,7 @@
"pnp-webpack-plugin": "1.4.3",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "7.0.1",
"postcss-normalize": "7.0.0",
"postcss-preset-env": "6.6.0",
"postcss-safe-parser": "4.0.1",
"prettier": "^1.17.0",
@@ -89,15 +89,15 @@
"react-app-polyfill": "^1.0.1",
"react-dev-utils": "^9.0.1",
"react-dom": "^16.8.6",
"resolve": "1.11.0",
"resolve": "1.11.1",
"sass-loader": "7.1.0",
"semver": "6.1.1",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.3.0",
"uglifyjs-webpack-plugin": "^2.1.2",
"url-loader": "1.1.2",
"webpack": "4.32.2",
"webpack-dev-server": "3.5.0",
"webpack": "4.33.0",
"webpack-dev-server": "3.5.1",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "4.3.1"
},

View File

@@ -123,6 +123,11 @@ declare module 'simple-keyboard' {
*/
useMouseEvents?: boolean;
/**
* Disable button hold action.
*/
disableButtonHold?: boolean;
/**
* Executes the callback function on key press. Returns button layout name (i.e.: "{shift}").
*/

View File

@@ -65,6 +65,7 @@ class SimpleKeyboard {
* @property {boolean} autoUseTouchEvents Enable useTouchEvents automatically when touch device is detected.
* @property {boolean} useMouseEvents Opt out of PointerEvents handling, falling back to the prior mouse event logic.
* @property {function} destroy Clears keyboard listeners and DOM elements.
* @property {boolean} disableButtonHold Disable button hold action.
*/
this.options = options;
this.options.layoutName = this.options.layoutName || "default";
@@ -245,22 +246,24 @@ class SimpleKeyboard {
/**
* @type {object} Time to wait until a key hold is detected
*/
this.holdTimeout = setTimeout(() => {
if (
this.isMouseHold &&
((!button.includes("{") && !button.includes("}")) ||
button === "{delete}" ||
button === "{backspace}" ||
button === "{bksp}" ||
button === "{space}" ||
button === "{tab}")
) {
if (this.options.debug) console.log("Button held:", button);
if (!this.options.disableButtonHold) {
this.holdTimeout = setTimeout(() => {
if (
this.isMouseHold &&
((!button.includes("{") && !button.includes("}")) ||
button === "{delete}" ||
button === "{backspace}" ||
button === "{bksp}" ||
button === "{space}" ||
button === "{tab}")
) {
if (this.options.debug) console.log("Button held:", button);
this.handleButtonHold(button, e);
}
clearTimeout(this.holdTimeout);
}, 500);
this.handleButtonHold(button, e);
}
clearTimeout(this.holdTimeout);
}, 500);
}
}
/**

View File

@@ -1232,4 +1232,14 @@ it('Keyboard destroy will work', () => {
keyboard.destroy();
expect(keyboard.keyboardDOM.innerHTML).toBeFalsy();
});
it('Keyboard disableButtonHold will work', () => {
testUtil.setDOM();
let keyboard = new Keyboard({
disableButtonHold: true
});
expect(keyboard.options.disableButtonHold).toBe(true);
});