Inline edit with vi style for jQuery
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
src
.gitignore
README.md

README.md

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):

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

  • keypressEvent is the event object
  • vieObject is an object which contains some VinlinEdit functions that you can use.

A callback which will be called before keypress processing.

It the return value is true, VInlinEdit won't process the event. It may be interessing for extending fonctionnalities such as Enter key, ...

calback_post_keypress

function (keypressEvent, vieObject)

Arguments are the same of calback_pre_keypress

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 the clear function by calling $('span.inline').data('vinlinedit').clear();.

Here's the list of functions:

Function name Arguments Return Description
clear(content)
  • (optional) content The new content of editor.
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.