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');
}
}
},
+5 -3
View File
@@ -332,15 +332,16 @@
.page .tag_input > ul {
list-style: none;
line-height: 20px;
padding: 3px 0;
border-radius: 3px;
cursor: text;
width: 31%;
width: 30%;
margin: 0 !important;
height: 27px;
line-height: 0;
display: inline-block;
}
.page .tag_input:hover > ul {
width: 50%;
border-radius: 3px 0 0 3px;
}
.page .tag_input:hover .formHint { display: none; }
@@ -354,6 +355,7 @@
margin: 0 !important;
border-width: 0;
background: 0;
line-height: 20px;
}
.page .tag_input > ul > li:first-child { min-width: 4px; }
.page .tag_input li.choice {