DEV: adds an experimental `preserveKey` bool option to autocomplete (#12751)
Usage: ``` $(input).autocomplete({ preserveKey: false }); ``` Defaults to true.
This commit is contained in:
parent
92e222d246
commit
99aae959a6
|
@ -85,6 +85,10 @@ export default function (options) {
|
|||
return this;
|
||||
}
|
||||
|
||||
if (options && typeof options.preserveKey === "undefined") {
|
||||
options.preserveKey = true;
|
||||
}
|
||||
|
||||
const disabled = options && options.disabled;
|
||||
let wrap = null;
|
||||
let autocompleteOptions = null;
|
||||
|
@ -199,7 +203,7 @@ export default function (options) {
|
|||
let text = me.val();
|
||||
text =
|
||||
text.substring(0, completeStart) +
|
||||
(options.key || "") +
|
||||
(options.preserveKey ? options.key || "" : "") +
|
||||
term +
|
||||
" " +
|
||||
text.substring(completeEnd + 1, text.length);
|
||||
|
|
Loading…
Reference in New Issue