MDL-57480 core_course: make drag and drop fire a dom updated event
authorJake Dallimore <jake@moodle.com>
Wed, 21 Dec 2016 03:46:04 +0000 (11:46 +0800)
committerJake Dallimore <jake@moodle.com>
Mon, 9 Jan 2017 23:42:52 +0000 (07:42 +0800)
When adding media via drag and drop, the notifyFilterContentUpdated
event should be called after the item is added to the DOM. This allows
things like videojs for example, to process the new content.

course/dndupload.js

index eb759d8..7c60ee0 100644 (file)
@@ -774,6 +774,10 @@ M.course_dndupload = {
                                 resel.li.outerHTML = unescape(resel.li.outerHTML);
                             }
                             self.add_editing(result.elementid);
+                            // Fire the content updated event.
+                            require(['core/event', 'jquery'], function(event, $) {
+                                event.notifyFilterContentUpdated($(result.fullcontent));
+                            });
                         } else {
                             // Error - remove the dummy element
                             resel.parent.removeChild(resel.li);