mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Merge "Immediately provide default suggestions based on 0 results."
This commit is contained in:
commit
d96b6a9622
|
@ -125,20 +125,19 @@
|
|||
}
|
||||
// Opens the MultiSuggest dropdown.
|
||||
function open() {
|
||||
if ( !visible ) {
|
||||
// Call input method if cached value is stale
|
||||
if (
|
||||
$input.val() !== '' &&
|
||||
$input.val() !== currentInput
|
||||
) {
|
||||
onInput();
|
||||
} else {
|
||||
// Show if there are suggestions.
|
||||
if ( $multiSuggest.children().length > 0 ) {
|
||||
visible = true;
|
||||
$multiSuggest.show();
|
||||
}
|
||||
}
|
||||
// Call onInput if cached value is stale
|
||||
if (
|
||||
$input.val() !== '' &&
|
||||
$input.val() !== currentInput
|
||||
) {
|
||||
onInput();
|
||||
}
|
||||
if (
|
||||
!visible &&
|
||||
$multiSuggest.children().length > 0
|
||||
) {
|
||||
$multiSuggest.show();
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
// Closes the dropdown.
|
||||
|
|
|
@ -337,7 +337,12 @@ ve.ui.LinkInspector.prototype.initMultiSuggest = function () {
|
|||
'results': suggestionCache[cKey]
|
||||
} );
|
||||
} else {
|
||||
// No cache, build fresh api request.
|
||||
// Load immediate suggestions
|
||||
callback( {
|
||||
'query': query,
|
||||
'results': []
|
||||
} );
|
||||
// Build from fresh api request.
|
||||
api.get( {
|
||||
'action': 'opensearch',
|
||||
'search': query
|
||||
|
|
Loading…
Reference in a new issue