mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Fix autocomplete
This commit is contained in:
parent
04b4c7438c
commit
6a4a457eb9
1 changed files with 20 additions and 11 deletions
|
@ -289,12 +289,19 @@ CliAutoComplete._initTextcomplete = function() {
|
||||||
* Then add `mousemove` handler. If the mouse moves we consider that mouse interaction
|
* Then add `mousemove` handler. If the mouse moves we consider that mouse interaction
|
||||||
* is desired so we reenable the `mouseover` handler
|
* is desired so we reenable the `mouseover` handler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const textCompleteDropDownElement = $('.textcomplete-dropdown');
|
||||||
|
|
||||||
if (!savedMouseoverItemHandler) {
|
if (!savedMouseoverItemHandler) {
|
||||||
// save the original 'mouseover' handeler
|
// save the original 'mouseover' handeler
|
||||||
savedMouseoverItemHandler = $._data($('.textcomplete-dropdown')[0], 'events').mouseover[0].handler;
|
try {
|
||||||
|
savedMouseoverItemHandler = $._data(textCompleteDropDownElement[0], 'events').mouseover[0].handler;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.textcomplete-dropdown')
|
if (savedMouseoverItemHandler) {
|
||||||
|
textCompleteDropDownElement
|
||||||
.off('mouseover') // initially disable it
|
.off('mouseover') // initially disable it
|
||||||
.off('mousemove') // avoid `mousemove` accumulation if previous show did not trigger `mousemove`
|
.off('mousemove') // avoid `mousemove` accumulation if previous show did not trigger `mousemove`
|
||||||
.on('mousemove', '.textcomplete-item', function(e) {
|
.on('mousemove', '.textcomplete-item', function(e) {
|
||||||
|
@ -306,6 +313,8 @@ CliAutoComplete._initTextcomplete = function() {
|
||||||
// trigger the mouseover handler to select the item under the cursor
|
// trigger the mouseover handler to select the item under the cursor
|
||||||
savedMouseoverItemHandler(e);
|
savedMouseoverItemHandler(e);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// textcomplete autocomplete strategies
|
// textcomplete autocomplete strategies
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue