1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add escape-to-clear to searchBox and other css fixes

This commit is contained in:
Nick O'Leary 2016-09-29 23:45:25 +01:00
parent 84457bc7b4
commit 9a49fb9450
2 changed files with 16 additions and 7 deletions

View File

@ -37,7 +37,12 @@
this.resultCount = $('<span>',{class:"red-ui-searchBox-resultCount hide"}).appendTo(this.uiContainer);
this.element.val("");
this.element.on("keyup",function() {
this.element.on("keydown",function(evt) {
if (evt.keyCode === 27) {
that.element.val("");
}
})
this.element.on("keyup",function(evt) {
that._change($(this).val());
});
@ -57,11 +62,14 @@
this.clearButton.show();
fireEvent = (val.length >= (this.options.minimumLength||0));
}
var current = this.element.val();
fireEvent = fireEvent && current !== this.lastSent;
if (fireEvent) {
if (!instant && this.options.delay > 0) {
clearTimeout(this.currentTimeout);
var that = this;
this.currentTimeout = setTimeout(function() {
that.lastSent = that.element.val();
that._trigger("change");
},this.options.delay);
} else {

View File

@ -16,6 +16,7 @@
.red-ui-searchBox-container {
position: relative;
i {
font-size: 10px;
color: #666;
@ -23,13 +24,13 @@
i.fa-search {
position: absolute;
pointer-events: none;
left: 12px;
top: 12px;
left: 8px;
top: 9px;
}
i.fa-times {
position: absolute;
right: 7px;
top: 12px;
right: 5px;
top: 9px;
}
input {
border-radius: 0;
@ -58,8 +59,8 @@
}
.red-ui-searchBox-resultCount {
position: absolute;
right: 22px;
top: 7px;
right: 18px;
top: 4px;
background: #eee;
color: #666;
padding: 1px 8px;