MOBILE-4508 h5p: Update H5P lib to 1.26

main
Dani Palou 2024-02-27 12:22:58 +01:00
parent 5ef95b611f
commit 8021e7ef5a
2 changed files with 34 additions and 0 deletions

View File

@ -2168,6 +2168,35 @@ H5P.trim = function (value) {
// So should we make this function deprecated? // So should we make this function deprecated?
}; };
/**
* Recursive function that detects deep empty structures.
*
* @param {*} value
* @returns {bool}
*/
H5P.isEmpty = value => {
if (!value && value !== 0 && value !== false) {
return true; // undefined, null, NaN and empty strings.
}
else if (Array.isArray(value)) {
for (let i = 0; i < value.length; i++) {
if (!H5P.isEmpty(value[i])) {
return false; // Array contains a non-empty value
}
}
return true; // Empty array
}
else if (typeof value === 'object') {
for (let prop in value) {
if (value.hasOwnProperty(prop) && !H5P.isEmpty(value[prop])) {
return false; // Object contains a non-empty value
}
}
return true; // Empty object
}
return false;
};
/** /**
* Check if JavaScript path/key is loaded. * Check if JavaScript path/key is loaded.
* *

View File

@ -31,6 +31,11 @@ import { CorePath } from '@singletons/path';
*/ */
export class CoreH5PCore { export class CoreH5PCore {
static readonly API_VERSION = {
majorVersion: 1,
minorVersion: 26,
};
static readonly STYLES = [ static readonly STYLES = [
'styles/h5p.css', 'styles/h5p.css',
'styles/h5p-confirmation-dialog.css', 'styles/h5p-confirmation-dialog.css',