Skip to content

Commit

Permalink
Released 0.6.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreavis committed Jul 29, 2013
1 parent c4e10c9 commit d7eab47
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 54 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "selectize",
"keywords": ["select", "ui", "form", "input", "control", "autocomplete", "tagging", "tag"],
"description": "Selectize is a jQuery-based custom <select> UI control. Useful for tagging, contact lists, country selectors, etc.",
"version": "0.6.6",
"version": "0.6.7",
"license": "Apache License, Version 2.0",
"readmeFilename": "README.md",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion selectize.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! selectize.css - v0.6.6 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
/*! selectize.css - v0.6.7 | https://github.com/brianreavis/selectize.js | Apache License (v2) */

/* --- file: "src/selectize.css" --- */

Expand Down
2 changes: 1 addition & 1 deletion selectize.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selectize",
"version": "0.6.6",
"version": "0.6.7",
"title": "Selectize.js",
"author": {
"name": "Brian Reavis",
Expand Down
37 changes: 28 additions & 9 deletions selectize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! selectize.js - v0.6.6 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
/*! selectize.js - v0.6.7 | https://github.com/brianreavis/selectize.js | Apache License (v2) */

(function(factory) {
if (typeof exports === 'object') {
Expand Down Expand Up @@ -1030,18 +1030,23 @@
* @returns {boolean}
*/
onOptionSelect: function(e) {
var value, $target, $option, self = this;

e.preventDefault && e.preventDefault();
e.stopPropagation && e.stopPropagation();
this.focus(false);
self.focus(false);

var $target = $(e.currentTarget);
$target = $(e.currentTarget);
if ($target.hasClass('create')) {
this.createItem();
self.createItem();
} else {
var value = $target.attr('data-value');
value = $target.attr('data-value');
if (value) {
this.setTextboxValue('');
this.addItem(value);
self.setTextboxValue('');
self.addItem(value);
if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
self.setActiveOption(self.getOption(value));
}
}
}
},
Expand Down Expand Up @@ -1799,8 +1804,9 @@
self.refreshClasses();

if (self.isSetup) {
// remove the option from the menu
options = self.$dropdown_content.find('[data-selectable]');

// update menu / remove the option
$option = self.getOption(value);
value_next = self.getAdjacentOption($option, 1).attr('data-value');
self.refreshOptions(true);
Expand Down Expand Up @@ -2088,12 +2094,16 @@
* @returns {boolean}
*/
deleteSelection: function(e) {
var i, n, direction, selection, values, caret, $tail;
var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
var self = this;

direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
selection = getSelection(self.$control_input[0]);

if (self.$activeOption && !self.settings.hideSelected) {
option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
}

// determine items that will be removed
values = [];

Expand Down Expand Up @@ -2132,6 +2142,15 @@

self.showInput();
self.refreshOptions(true);

// select previous option
if (option_select) {
$option_select = self.getOption(option_select);
if ($option_select.length) {
self.setActiveOption($option_select);
}
}

return true;
},

Expand Down
Loading

0 comments on commit d7eab47

Please sign in to comment.