https://github.com/nieyuyao/simple-ime
A simple web pinyin input method
https://github.com/nieyuyao/simple-ime
ime input-method pinyin web-input-method
Last synced: 3 months ago
JSON representation
A simple web pinyin input method
- Host: GitHub
- URL: https://github.com/nieyuyao/simple-ime
- Owner: nieyuyao
- License: mit
- Created: 2025-01-19T14:35:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-28T03:18:57.000Z (3 months ago)
- Last Synced: 2026-02-28T09:55:01.633Z (3 months ago)
- Topics: ime, input-method, pinyin, web-input-method
- Language: TypeScript
- Homepage:
- Size: 4.17 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README-en.md
- License: LICENSE
Awesome Lists containing this project
README
## Simple Ime



A simple browser tool to use Chinese Pinyin Input Method (IME).

Compared with [Goole Input tools](https://www.google.com/inputtools/try/), it carries a offline dictionary, so there is no need to connect the server to complete the pinyin conversion.
Accordingly, due to the offline dictionary, the bundle cannot be very small. In addition, `iframe` is not supported.
## Hotkeys
| Hotkey | Description |
| --- | --- |
| ↑ | Page up |
| ↓ | Page down |
| + | Page up |
| - | Page down |
| ← | Switch to the previous candidate word |
| → | Switch to the next candidate word |
| < | Switch to the previous candidate word |
| > | Switch to the next candidate word |
| Shift | Toggle En and pinyin |
| Enter | Type the current result directly |
| [ | Move the cursor on input of ime to left |
| ] | Move the cursor on input of ime to right |
## Install
> npm install simple-ime
## Usage
```js
import { createSimpleIme } from 'simple-ime'
const ime = createSimpleIme()
// turn on ime
ime.turnOn()
// turn off ime
ime.turnOff()
```
## APIs
### createSimpleIme
Create ime instance.
`function createSimpleIme(): SimpleImeInstance`
### SimpleImeInstance
#### Properties:
##### version
Version of ime.
`version: string`
#### Methods:
##### turnOn
Turn on the ime.
`function turnOn(): void`
##### turnOff
Turn off the ime.
`function turnOff(): void`
##### toggleOnOff
Toggle the ime.
`function toggleOnOff(): void`
##### dispose
Destroy the ime instance.
`function dispose(): void`
## Development
Run `npm run dev` and then open browser.
## Build
```shell
npm run build
```
## Credits
- The input part of the implementation is heavily inspired by [CloudInput](https://github.com/mzhangdev/CloudInput).
- Thanks to [web-pinyin-ime](https://github.com/dongyuwei/web-pinyin-ime). It provides a way to generate dictionary and optimize query speed.