editable-text: Allow autocomplete with wrapping
This commit is contained in:
parent
3e6cc03e2e
commit
38764efb5a
1 changed files with 5 additions and 5 deletions
|
@ -194,17 +194,17 @@
|
||||||
let autocompleteParams = this.autocomplete;
|
let autocompleteParams = this.autocomplete;
|
||||||
let autocompleteEnabled = !this.multiline && !!autocompleteParams;
|
let autocompleteEnabled = !this.multiline && !!autocompleteParams;
|
||||||
if (!this._input
|
if (!this._input
|
||||||
|| (this._input.constructor.name === 'AutocompleteInput') !== autocompleteEnabled
|
|| (this._input.hasAttribute('autocomplete')) !== autocompleteEnabled
|
||||||
|| this._input.tagName !== (this.noWrap ? 'input' : 'textarea')) {
|
|| this._input.tagName !== (this.noWrap ? 'input' : 'textarea')) {
|
||||||
let input;
|
let input;
|
||||||
|
let inputTagName = this.noWrap ? 'input' : 'textarea';
|
||||||
if (autocompleteEnabled) {
|
if (autocompleteEnabled) {
|
||||||
input = document.createElement('input', { is: 'autocomplete-input' });
|
input = document.createElement(inputTagName, { is: `autocomplete-${inputTagName}` });
|
||||||
input.type = 'autocomplete';
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
input = this.noWrap ? document.createElement('input') : document.createElement('textarea');
|
input = document.createElement(inputTagName);
|
||||||
input.rows = 1;
|
|
||||||
}
|
}
|
||||||
|
input.rows = 1;
|
||||||
input.classList.add('input');
|
input.classList.add('input');
|
||||||
input.toggleAttribute("no-windows-native", true);
|
input.toggleAttribute("no-windows-native", true);
|
||||||
input.addEventListener('input', this._handleInput);
|
input.addEventListener('input', this._handleInput);
|
||||||
|
|
Loading…
Reference in a new issue