hailwood/jQuery-Tagit — pull request #65 by AAverin (2012-11-27 10:09:26+00:00)
Title: Tag edit support

Implemented tags edit feature, added a couple of fixes.
Details:

small fixes:
1. 'style' is now cleared after highlight animation, so it no longer messes with other things you want to style.
2. fixed #61

features:
1. each tag label is now marked as 'tagit-label' class - simplifies use of ellipsis for tags and etc.
2. option 'editable', methods _edit and _postEdit were added

Edit logic:
if 'editable=true' click on a tag:
- hides corresponding tagit-label using class 'hidden'
- adds an input with class 'tagit-edit' and width of hidden tagit-label.
- adds 'edited' class to parent 'tagit-choice'
- selects tag label text in added input by call to .select()
'blur' call of that added input:
- uses only first available value - line is splitted with _splitAt and first value is used
- if value is identical to old tag label - editing finished, nothing changed, all inputs and classes removed
- otherwise tries to add a new tag with _addTag. If fails (eg. tag with same value already exists) - stays at edit state
- if _addTag succeeds:
- new tag is added at the end of tagsArray
- removes old tag with _popTag and removes corresponding DOM element
- moves last added tag to the place where old tag was with 'insertBefore' and _moveTag
- fires 'tagsChanged' if it's present
- finished editing process by removing inputs and classes like 'edited' and 'hidden'

Anyway, all this is in code, some comments were also added.
With lots of css changes for tagit in my project I wasn't able to add sample styles for: 'tagit-edit', 'hidden', 'edited', 'tagit-label'
I hope you will figure our yourself how to style these parts.

Changes were also added to tagit-themeroller, although weren't tested, so be careful when using.