focus on searcn bar shortcut
This commit is contained in:
@@ -162,6 +162,9 @@ function (Dep, /** typeof module:search-manager.Class */SearchManager) {
|
||||
'Control+Space': function (e) {
|
||||
this.handleShortcutKeyCtrlSpace(e);
|
||||
},
|
||||
'Control+Slash': function (e) {
|
||||
this.handleShortcutKeyCtrlSlash(e);
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -767,5 +770,26 @@ function (Dep, /** typeof module:search-manager.Class */SearchManager) {
|
||||
|
||||
this.actionCreate({focusForCreate: true});
|
||||
},
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {JQueryKeyEventObject} e
|
||||
*/
|
||||
handleShortcutKeyCtrlSlash: function (e) {
|
||||
if (!this.searchPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
let $search = this.$el.find('input.text-filter').first();
|
||||
|
||||
if (!$search.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
$search.focus();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -56,6 +56,15 @@ define('views/modals/select-records', ['views/modal', 'search-manager'], functio
|
||||
|
||||
className: 'dialog dialog-record',
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
shortcutKeys: {
|
||||
'Control+Slash': function (e) {
|
||||
this.handleShortcutKeyCtrlSlash(e);
|
||||
},
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
createButton: this.createButton,
|
||||
@@ -171,9 +180,7 @@ define('views/modals/select-records', ['views/modal', 'search-manager'], functio
|
||||
}
|
||||
|
||||
this.loadSearch();
|
||||
|
||||
this.wait(true);
|
||||
|
||||
this.loadList();
|
||||
});
|
||||
},
|
||||
@@ -334,5 +341,26 @@ define('views/modals/select-records', ['views/modal', 'search-manager'], functio
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {JQueryKeyEventObject} e
|
||||
*/
|
||||
handleShortcutKeyCtrlSlash: function (e) {
|
||||
if (!this.searchPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
let $search = this.$el.find('input.text-filter').first();
|
||||
|
||||
if (!$search.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
$search.focus();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user