mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 03:34:33 +02:00
Update InputfieldPageAutocomplete.js to initialize the autocomplete on focus event, rather than on document ready. This resolves a render time issue in AdminThemeUikit when there are a lot of autocomplete inputs present, per @Toutouwai
This commit is contained in:
@@ -98,6 +98,7 @@ var InputfieldPageAutocomplete = {
|
|||||||
return allowed;
|
return allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$input.one('focus', function() {
|
||||||
$input.autocomplete({
|
$input.autocomplete({
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
@@ -199,7 +200,7 @@ var InputfieldPageAutocomplete = {
|
|||||||
}
|
}
|
||||||
numAdded++;
|
numAdded++;
|
||||||
// new items have a negative page_id
|
// new items have a negative page_id
|
||||||
var page = { page_id: (-1 * numAdded), label: $input.val() };
|
var page = {page_id: (-1 * numAdded), label: $input.val()};
|
||||||
// add it to the list
|
// add it to the list
|
||||||
if(noList) {
|
if(noList) {
|
||||||
// adding new item while using input as the label
|
// adding new item while using input as the label
|
||||||
@@ -240,6 +241,7 @@ var InputfieldPageAutocomplete = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var makeSortable = function($ol) {
|
var makeSortable = function($ol) {
|
||||||
$ol.sortable({
|
$ol.sortable({
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -177,7 +177,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
|
|||||||
$operator = $this->operator;
|
$operator = $this->operator;
|
||||||
$id = $this->id;
|
$id = $this->id;
|
||||||
$max = (int) $this->maxSelectedItems;
|
$max = (int) $this->maxSelectedItems;
|
||||||
$class = $this->useList ? 'has_list' : 'no_list';
|
$class = 'ui-autocomplete-input ' . ($this->useList ? 'has_list' : 'no_list');
|
||||||
if($this->useAndWords) $class .= " and_words";
|
if($this->useAndWords) $class .= " and_words";
|
||||||
if($this->allowAnyValue) $class .= " allow_any";
|
if($this->allowAnyValue) $class .= " allow_any";
|
||||||
|
|
||||||
|
@@ -331,5 +331,7 @@ $(document).ready(function() {
|
|||||||
id: 'PageEditLinkTabs'
|
id: 'PageEditLinkTabs'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
$('#link_page_url_input').focus();
|
$('#link_page_url_input').focus();
|
||||||
|
}, 250);
|
||||||
});
|
});
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user