MDL-64917 filepicker: change event dispatch

This commit is contained in:
Nathan Nguyen 2019-09-12 10:26:24 +10:00
parent a672f021ea
commit 5b54a1c726

View File

@ -683,7 +683,7 @@ M.core_filepicker.init = function(Y, options) {
if (scope.options.editor_target && scope.options.env == 'editor') {
// editor needs to update url
scope.options.editor_target.value = urlimage;
scope.options.editor_target.onchange();
scope.options.editor_target.dispatchEvent(new Event('change'), {'bubbles': true});
}
var fileinfo = {'client_id':scope.options.client_id,
'url': urlimage,
@ -700,7 +700,7 @@ M.core_filepicker.init = function(Y, options) {
var data = this.process_dlg.dialogdata;
if (scope.options.editor_target && scope.options.env == 'editor') {
scope.options.editor_target.value = data.newfile.url;
scope.options.editor_target.onchange();
scope.options.editor_target.dispatchEvent(new Event('change'), {'bubbles': true});
}
scope.hide();
var formcallback_scope = scope.options.magicscope ? scope.options.magicscope : scope;
@ -1235,7 +1235,7 @@ M.core_filepicker.init = function(Y, options) {
}
if (scope.options.editor_target && scope.options.env=='editor') {
scope.options.editor_target.value=obj.url;
scope.options.editor_target.onchange();
scope.options.editor_target.dispatchEvent(new Event('change'), {'bubbles': true});
}
scope.hide();
obj.client_id = client_id;
@ -1803,7 +1803,7 @@ M.core_filepicker.init = function(Y, options) {
}
if (scope.options.editor_target&&scope.options.env=='editor') {
scope.options.editor_target.value=o.url;
scope.options.editor_target.onchange();
scope.options.editor_target.dispatchEvent(new Event('change'), {'bubbles': true});
}
scope.hide();
o.client_id = client_id;