VInlinEdit jQuery Plugin v1.0.0
Copyright (c) 2012 Samuel ROZE. Licenced under the GPLv3 license.
Overview
Vinlinedit is a jQuery plugin that provide an inline edit for text spans. The principal attribute is that the editor's style is like vi.
Requirements
This plugin requires this tow librairies (which are in the lib
directory):
- jQuery
- jsAsyncQueue (see JavaScript: Synchroniser des événements asynchrones (fr) to see an example of use)
How to use
In order to use this plugin, you just have to include the JS and CSS files (and, of course, the requirements) which are in the src
folder.
Then, you can see the examples
folder, or this simple example:
$('span.vinlinedit').vinlinedit(options);
The option
argument is an object.
Options
There are 3 options at the moment, which are:
Option name | Value(s) | Description |
prefix | string | A string which will prefix the inline editor. |
calback_pre_keypress |
function (keypressEvent, vieObject) returns boolean
|
A callback which will be called before keypress processing. It the return value is |
calback_post_keypress |
function (keypressEvent, vieObject) Arguments are the same of |
A callback which will be called after keypress processing. |
Interactions & Functions
VinlinEdit provides functions to interact with the inline editor. Functions are stored in an object that you can retreive by tow way:
- The second argument of callbacks is this object.
- You can retrieve the object using
data('vinlinedit')
. For example, if you've initialized VInlinEdit with$('span.inline')
, you can can theclear
function by calling$('span.inline').data('vinlinedit').clear();
.
Here's the list of functions:
Function name | Arguments | Return | Description |
clear(content) |
|
object The functions object, so you can chain. |
Clear the inline editor and reset as the initial state or with the parameters. |
getContent() | No argument |
string The content of the inline editor |
Returns the content of inline editor. |