Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
feat: add support for design mode (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
eventualbuddha authored Jul 13, 2016
1 parent 5343a7c commit 28af0d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"babelrc-rollup": "^2.0.0",
"browserify": "^13.0.1",
"detect-node": "^2.0.3",
"dom-element-is-natively-editable": "^1.0.3",
"es5-shim": "^4.5.9",
"jsdom": "^3.1.2",
"karma": "^1.1.1",
Expand All @@ -51,6 +52,7 @@
"mocha": "^2.5.3",
"rollup": "^0.34.1",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-node-resolve": "^1.7.1",
"semantic-release": "^4.3.5",
"watchify": "^3.7.0"
}
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import babel from 'rollup-plugin-babel';
import babelrc from 'babelrc-rollup';
import nodeResolve from 'rollup-plugin-node-resolve';

var pkg = require('./package.json');

export default {
entry: 'src/keysim.js',
plugins: [
babel(babelrc())
babel(babelrc()),
nodeResolve({ jsnext: true })
],
targets: [
{
Expand Down
14 changes: 3 additions & 11 deletions src/keysim.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* jshint esnext:true, undef:true, unused:true */

import isEditable from 'dom-element-is-natively-editable';

const CTRL = 1 << 0;
const META = 1 << 1;
const ALT = 1 << 2;
Expand Down Expand Up @@ -417,17 +419,7 @@ export class Keyboard {
targetCanReceiveTextInput(target) {
if (!target) { return false; }

switch (target.nodeName && target.nodeName.toLowerCase()) {
case 'input':
let type = target.type;
return !(type === 'hidden' || type === 'radio' || type === 'checkbox');

case 'textarea':
return true;

default:
return false;
}
return isEditable(target);
}
}

Expand Down

0 comments on commit 28af0d7

Please sign in to comment.