Bugfix: inputosaurus revamp failed due to missing onChange handling

This commit is contained in:
djmaze 2020-09-23 13:07:44 +02:00
parent 39f39db447
commit 673f1bff79
2 changed files with 8 additions and 12 deletions

View file

@ -79,9 +79,9 @@ ko.bindingHandlers.emailsTags = {
}).flat(Infinity).map( }).flat(Infinity).map(
item => (item.toLine ? [item.toLine(false), item] : [item, null]) item => (item.toLine ? [item.toLine(false), item] : [item, null])
), ),
change: event => { onChange: value => {
element.EmailsTagsValue = event.target.value; element.EmailsTagsValue = value;
fValue(event.target.value); fValue(value);
} }
}); });

View file

@ -43,11 +43,6 @@ window.Inputosaurus = class {
self.options = Object.assign({ self.options = Object.assign({
// bindable events
//
// 'change' - triggered whenever a tag is added or removed (should be similar to binding the the change event of the instantiated input
// 'keyup' - keyup event on the newly created input
// while typing, the user can separate values using these delimiters // while typing, the user can separate values using these delimiters
// the value tags are created on the fly when an inputDelimiter is detected // the value tags are created on the fly when an inputDelimiter is detected
inputDelimiters : [',', ';', '\n'], inputDelimiters : [',', ';', '\n'],
@ -61,7 +56,9 @@ window.Inputosaurus = class {
// the array of tag names is passed and expected to be returned as an array after manipulation // the array of tag names is passed and expected to be returned as an array after manipulation
parseHook : null, parseHook : null,
splitHook : null splitHook : null,
onChange : null
}, options); }, options);
self._chosenValues = []; self._chosenValues = [];
@ -93,7 +90,6 @@ window.Inputosaurus = class {
} }
element.replaceWith(els.ul); element.replaceWith(els.ul);
element.hidden = true;
els.inputCont = createEl('li',{class:"inputosaurus-input"}); els.inputCont = createEl('li',{class:"inputosaurus-input"});
els.inputCont.append(els.input); els.inputCont.append(els.input);
@ -344,9 +340,9 @@ window.Inputosaurus = class {
} }
_setValue(value) { _setValue(value) {
var val = this.element.value; if (this.element.value !== value) {
if (val !== value) {
this.element.value = value; this.element.value = value;
this.options.onChange(value);
} }
} }