From 3b4e867e6892a18304816b6eab01d905e0fe33a4 Mon Sep 17 00:00:00 2001
From: Frode Petterson <frode.andre.petterson@gmail.com>
Date: Mon, 18 May 2020 11:34:28 +0200
Subject: [PATCH] Fix compatibility with newer jQuery versions
(cherry picked from commit 757f7053cd0af26df95b0f12f0141fe98848cea6)
---
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 b2e097b2..84b26b21 100644
--- a/scripts/h5peditor-av.js
+++ b/scripts/h5peditor-av.js
@@ -119,8 +119,8 @@ H5PEditor.widgets.video = H5PEditor.widgets.audio = H5PEditor.AV = (function ($)
'</div>';
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');
@@ -587,7 +587,7 @@ H5PEditor.widgets.video = H5PEditor.widgets.audio = H5PEditor.AV = (function ($)
const id = 'av-upload-' + C.getNextId();
return '<h3 id="' + id + '">' + H5PEditor.t('core', type === 'audio' ? 'uploadAudioTitle' : 'uploadVideoTitle') + '</h3>' +
'<div class="h5p-file-drop-upload" tabindex="0" role="button" aria-labelledby="' + id + '">' +
- '<div class="h5p-file-drop-upload-inner"/>' +
+ '<div class="h5p-file-drop-upload-inner ' + type + '"></div>' +
'</div>';
case 'InputLinkURL':
diff --git a/scripts/h5peditor-editor.js b/scripts/h5peditor-editor.js
index bcfa90d8..d9d4a378 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;
}
--
GitLab