From 757f7053cd0af26df95b0f12f0141fe98848cea6 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 18 May 2020 11:34:28 +0200 Subject: [PATCH] Fix compatibility with newer jQuery versions --- scripts/h5peditor-av.js | 4 ++-- scripts/h5peditor-editor.js | 2 +- scripts/h5peditor-group.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/h5peditor-av.js b/scripts/h5peditor-av.js index 8702fc75..68a3fcb2 100644 --- a/scripts/h5peditor-av.js +++ b/scripts/h5peditor-av.js @@ -119,8 +119,8 @@ H5PEditor.widgets.video = H5PEditor.widgets.audio = H5PEditor.AV = (function ($) ''; var html = H5PEditor.createFieldMarkup(this.field, imageHtml, id); - var $container = $(html).appendTo($wrapper); + this.$files = $container.children('.file'); this.$add = $container.children('.h5p-add-file').click(function () { self.$addDialog.addClass('h5p-open'); @@ -589,7 +589,7 @@ H5PEditor.widgets.video = H5PEditor.widgets.audio = H5PEditor.AV = (function ($) const id = 'av-upload-' + C.getNextId(); return '

' + H5PEditor.t('core', isAudio ? 'uploadAudioTitle' : 'uploadVideoTitle') + '

' + '
' + - '
' + + '
' + '
'; case 'InputLinkURL': diff --git a/scripts/h5peditor-editor.js b/scripts/h5peditor-editor.js index ff3c919d..2c9922f2 100644 --- a/scripts/h5peditor-editor.js +++ b/scripts/h5peditor-editor.js @@ -230,7 +230,7 @@ ns.Editor = function (library, defaultParams, replace, iframeLoaded) { // Need to put this after the above replaceAll(), since that one makes Safari // 11 trigger a load event for the iframe - $iframe.load(load); + $iframe.on('load', load); // Populate iframe with the H5P Editor // (should not really be done until 'load', but might be here in case the iframe is reloaded?) diff --git a/scripts/h5peditor-group.js b/scripts/h5peditor-group.js index 47d26d8d..2c156960 100644 --- a/scripts/h5peditor-group.js +++ b/scripts/h5peditor-group.js @@ -313,7 +313,7 @@ ns.Group.prototype.setSummary = function (summary) { // Parse html var summaryTextNode = ns.$.parseHTML(summary); - if (summaryTextNode !== null) { + if (summaryTextNode !== null && summaryTextNode.length) { summaryText = summaryTextNode[0].nodeValue; }