Git Product home page Git Product logo

jquery.bangla's Introduction

Bangla Input Tools

npm (tag) Build Status NPM Downloads Maintainability License GitHub stars

A versatile bangla input tools for the web

Live Demo: https://dipu-bd.github.io/jquery.bangla/

Installation

npm i --save jquery jquery.bangla

Usage

import 'jquery.bangla';

// Or,
require('jquery.bangla');

// Then, on some editable elements...

$('input[type="text"]').bangla(); // input box

$('textarea').bangla(); // text area

$('div[contenteditable="true"]').bangla(); // content editable div

$('.note-editable').bangla() // summer-note (a free WYSWYG editor)

Usage (Browser)

  1. Clone this repository and go to project folder.
  2. Perform npm install
  3. Then npm run build
  4. Copy the script file inside dist/ folder to your static assets directory
  5. See the example in gh-pages branch for usage.

API

Initial Configuration

You an pass the following configs during initialization (all configs are optional):

// all the default values are given here
$('<some-element-selectoor>').bangla({
  enable: false,
  maxSuggestions: 10,
  disableSuggestion: false,
  storeKey: '__avro--candidates',
  store: window.localStorage,
  provider: /* see below */
})

Config: enable

Pass true to enable bangla right after initialization.

Config: maxSuggestions

The maximum number of suggestions that user will see for a word.

Config: disableSuggestion

Pass true if you do not want to display the suggestion box.

Config: storeKey

The key that is used for storing candidate words.

Config: store

The storage to save candidate words. A cadidate word is a bangla word that user had select against an english word. In the next suggestion box for that english word, the cadidate word will be automatically selected.

The store should haeve two fields:

  • getItem(key): Returns the value given the key
  • setItem(key, val): Stores the value against the key to retriee it later.

Config: provider

By default, Avro Phonetic from https://github.com/omicronlab/avro-pad is used. But you can define your own provider. A provider should have three fields.

  • suggest(word): This will return an object containing words field. The field words is an array of possible bangla word for the given english word.
  • candidate(word): This will return previously selected bangla word for the english input.
  • commit(word, bangla): It will save the candidate bangla word for an english word.

Methods

You can customize the input tool after initialization:

  • $('input').bangla('toggle'): Toggles the input option between bangla and english.
  • $('input').bangla('on'): Enables the bangla mode.
  • $('input').bangla('off'): Disables the bangla mode.
  • $('input').bangla('enable'): Get whether the bangla is enabled for a single element.
  • $('input').bangla('enable', true): Enables the bangla mode.
  • $('input').bangla('enable', false): Disable the bangla mode.
  • $('input').bangla('tool'): Access the BanglaInputTool instance for a single element.

License

Mozilla Public License Version 2.0

jquery.bangla's People

Contributors

dependabot[bot] avatar dipu-bd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jquery.bangla's Issues

ckeditor error

is not working with CKEditor, as it is told that it will work with all editable content

Add original word in the suggested listbox

Thanks for creating this great tool

I was wondering even though user can toggle keyboard on/off, it probably would be nice if we add the originally English word at the bottom of the suggestion listbox for user to select if required.

UseCase : user forgot to toggle off the bangla keyboard and now typed something like "chair". he/she would be able to select it from the drop down instead of deleting the word, toggling off bangla and retyping again.

Characters in word is not merging in ContentEditable

Join two words if no spaces are between them.

  • First type word: বাংলাদেশ
  • Now put you cursor before the last character: শ
  • Type শেই
  • The matra of the word does not get together: বাংলাদেশেই

Possible solution:

  • On control character press, determine the word being edited, and replace it with a merged one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.