JSPM

simple-keyboard-autocorrect

1.2.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5353
  • Score
    100M100P100Q115907F
  • License MIT

Autocorrect module for simple-keyboard

Package Exports

  • simple-keyboard-autocorrect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-keyboard-autocorrect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Autocorrect module for simple-keyboard

Build Status

Installation

npm

npm install simple-keyboard simple-keyboard-autocorrect --save

zip file (self-hosted)

Click here to download the latest release (zip format).

Want to use a CDN instead of self-host? Scroll down to the "Usage with CDN" instructions below.

Usage with npm

import Keyboard from "simple-keyboard";
import autocorrect from "simple-keyboard-autocorrect";

// CSS
import 'simple-keyboard/build/css/index.css';

let wordList = ["my", "word", "list"];

let keyboard = new Keyboard({
  onChange: input => onChange(input),
  onKeyPress: button => onKeyPress(button),
  autocorrectDict: wordList,
  modules: [
    autocorrect
  ]
});

function onChange(input){
  document.querySelector(".input").value = input;
  console.log("Input changed", input);
}

function onKeyPress(button){
  console.log("Button pressed", button);
}

html

<input class="input" />
<div class="simple-keyboard"></div>

Usage with CDN

html

<html>
<head>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-keyboard@latest/build/css/index.css">
</head>

<body>
  <input class="input" />
  <div class="simple-keyboard"></div>

  <script src="https://cdn.jsdelivr.net/npm/simple-keyboard@latest/build/index.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/simple-keyboard-autocorrect@latest/build/index.min.js"></script>
  <script src="src/index.js"></script>
</body>

</html>

js (index.js)

let Keyboard = window.SimpleKeyboard.default;
let autocorrect = window.SimpleKeyboardAutocorrect.default;

let wordList = ["my", "word", "list"];

let keyboard = new Keyboard({
  onChange: input => onChange(input),
  onKeyPress: button => onKeyPress(button),
  autocorrectDict: wordList,
  modules: [
    autocorrect
  ]
});

function onChange(input){
  document.querySelector(".input").value = input;
  console.log("Input changed", input);
}

function onKeyPress(button){
  console.log("Button pressed", button);
}

Options and Customization

To fully customize your virtual keyboard, check out the main simple-keyboard repository: