textcomplete

Autocomplete for textarea elements

  • 所有者: yuku/textcomplete
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

textcomplete

Autocomplete for textarea elements.

NPM version
Build Status
Code Climate
Test Coverage
Stable Release Size
Analytics

Requirements

Distributed scripts are self-contained.

To require as npm package, textcomplete requires the following to run:

Usage

Textcomplete is easiest to use when installed with npm:

npm install --save textcomplete

Then you can load the module into your code with require call:

var { Textcomplete, Textarea } = require('textcomplete');

The Textarea object is a kind of editor class. An editor encapsulates an HTML element where users input text. The Textarea editor is an editor for textarea element.

You can find some additional editors at List of editors wiki.

The Textcomplete is the core object of textcomplete.

var editor = new Textarea(textareaElement);
var textcomplete = new Textcomplete(editor);

Register series of autocomplete strategies:

textcomplete.register([{
  // Emoji strategy
  match: /(^, \s):(\w+)$/,
  search: function (term, callback) {
    callback(emojies.filter(emoji => { return emoji.startsWith(term); }));
  },
  replace: function (value) {
    return '$1:' + value + ': ';
  }
}, {
  // Another strategy
  ...
}]);

Now, the textcomplete listens keyboard event on the editor and render autocomplete dropdown when one of the strategy matches to the inputted value.

Browser Support

Chrome, Firefox, Internet Explorer, Opera, Safari
:-------:, :--------:, :-----------------:, :-------:, :-------:
Current, Current, 10+, Current, Current

Install

If your project is using npm, you can install textcomplete package by npm command:

npm install --save textcomplete

if not, you can download released packages from the release page which contain bundled scripts in dist directory.

Contributing

To contribute to textcomplte, clone this repo locally and commit your code on a separate branch.
Please write unit tests for your code, and run the linter before opening a pull-request:

npm test # run linter and all tests

You can find more detail in our contributing guide.

License

The MIT License

主要指标

概览
名称与所有者yuku/textcomplete
主编程语言TypeScript
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2013-08-24 06:22:06
推送于2023-12-11 03:25:12
最后一次提交
发布数84
最新版本名称v0.1.13 (发布于 )
第一版名称jquery-v0.0.2 (发布于 )
用户参与
星数1.7k
关注者数61
派生数301
提交数504
已启用问题?
问题数227
打开的问题数14
拉请求数92
打开的拉请求数1
关闭的拉请求数43
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?