MediaFinder: trigger change event (#3446)

Credit to @scorewinner.
This commit is contained in:
Tim 2018-12-04 18:12:26 +01:00 committed by Luke Towers
parent 9ce6b4fbc8
commit caf7cb406f
1 changed files with 9 additions and 2 deletions

View File

@ -78,8 +78,15 @@
BaseProto.dispose.call(this)
}
MediaFinder.prototype.setValue = function(value) {
// set value and trigger change event, so that wrapping implementations
// like mlmediafinder can listen for changes.
this.$findValue.val(value).trigger('change')
}
MediaFinder.prototype.onClickRemoveButton = function() {
this.$findValue.val('')
this.setValue('')
this.evalIsPopulated()
}
@ -106,7 +113,7 @@
publicUrl = items[i].publicUrl
}
self.$findValue.val(path)
self.setValue(path)
if (self.options.isImage) {
$('[data-find-image]', self.$el).attr('src', publicUrl)