Misprint — simple and tiny library, that lets you quickly add a typo notifyer to your site.
- 279 bytes (minified and gzipped). It uses Size Limit to control size.
- Only one exported function.
- Reassignable keystroke.
- Full control of the message.
const messageFormatter = `Hi!You made a typo: Whole paragraph: Link: `
ES Modules
Misprint avaliable as ES Module, so you can install from npm and use it with any modern bundling system.
npm install misprint
Or even with browser from CDN in supported browsers.
Custom keystroke
bindTypoHandler
accepts button predicate as 4th parameter. Default Ctrl+Enter predicate looks like this:
/** * Predicate to test key input * @name KeyPredicate * @param * @returns */const ctrlEnter = ectrlKey || emetaKey && ekeyCode === 13
If you want to assign other keystroke, pass custom predicate to function.
const ctrlU = ectrlKey || emetaKey && ekeyCode === 85
If you want to assign ctrl+* keystroke, dont forget to check e.metaKey
. It's command (⌘) key in macOS.