Renaming option bugs out when empty

This commit is contained in:
Ruud
2012-06-27 16:02:08 +02:00
parent 63a7ba85f3
commit d98ffbf7da
2 changed files with 11 additions and 5 deletions
+6 -2
View File
@@ -941,6 +941,9 @@ Option.Choice = new Class({
mtches.append([value == matchsplit ? match : matchsplit]);
});
});
if(mtches.length == 0 && value != '')
mtches.include(value);
mtches.each(self.addTag.bind(self));
@@ -963,7 +966,7 @@ Option.Choice = new Class({
},
addLastTag: function(){
if(this.tag_input.getElement('li.choice:last-child'))
if(this.tag_input.getElement('li.choice:last-child') || !this.tag_input.getElement('li'))
this.addTag('');
},
@@ -1151,7 +1154,7 @@ Option.Choice.Tag = new Class({
var temp_input = new Element('input', {
'events': {
'keyup': function(e){
'keydown': function(e){
e.stop();
if(e.key == 'right'){
@@ -1165,6 +1168,7 @@ Option.Choice.Tag = new Class({
else if (e.key == 'backspace'){
self.del();
this.destroy();
self.fireEvent('goLeft');
}
}
},