Skip to content

Commit

Permalink
Merge pull request aehlke#150 from kevinslin/master
Browse files Browse the repository at this point in the history
Add option to preprocessTags before creatingTag
  • Loading branch information
aehlke committed Mar 4, 2013
2 parents 6da7950 + 8a0f47a commit 63f7c11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
8 changes: 6 additions & 2 deletions js/tag-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
//
// The easiest way to use singleField is to just instantiate tag-it
// on an INPUT element, in which case singleField is automatically
// set to true, and singleFieldNode is set to that element. This
// set to true, and singleFieldNode is set to that element. This
// way, you don't need to fiddle with these options.
singleField: false,

Expand Down Expand Up @@ -235,7 +235,7 @@

// Comma/Space/Enter are all valid delimiters for new tags,
// except when there is an open quote or if setting allowSpaces = true.
// Tab will also create a tag, unless the tag input is empty,
// Tab will also create a tag, unless the tag input is empty,
// in which case it isn't caught.
if (
event.which === $.ui.keyCode.COMMA ||
Expand Down Expand Up @@ -389,6 +389,10 @@

value = $.trim(value);

if(this.options.preprocessTag) {
value = this.options.preprocessTag(value);
}

if (value === '') {
return false;
}
Expand Down
16 changes: 1 addition & 15 deletions js/tag-it.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63f7c11

Please sign in to comment.