MDL-64917 filepicker: change event dispatch
authorNathan Nguyen <nathannguyen@catalyst-au.net>
Thu, 12 Sep 2019 00:26:24 +0000 (10:26 +1000)
committerNathan Nguyen <nathannguyen@catalyst-au.net>
Thu, 12 Sep 2019 00:57:21 +0000 (10:57 +1000)
repository/filepicker.js

index d273aa5..934085f 100644 (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;