From 36e2f7e13e0a88b9df57055a3ca9978bf3fb1e85 Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Thu, 18 Jan 2024 21:55:10 +0100 Subject: [PATCH] Add H5P.CheckboxList and H5P.DropdownField --- library.json | 10 ++++++++++ semantics.json | 2 ++ standard-page.js | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 740467b..2229c51 100644 --- a/library.json +++ b/library.json @@ -37,6 +37,16 @@ "machineName": "H5P.TextInputField", "majorVersion": 1, "minorVersion": 2 + }, + { + "machineName": "H5P.CheckboxList", + "majorVersion": 1, + "minorVersion": 0 + }, + { + "machineName": "H5P.DropdownField", + "majorVersion": 1, + "minorVersion": 0 } ] } diff --git a/semantics.json b/semantics.json index df4c2e9..768d25d 100644 --- a/semantics.json +++ b/semantics.json @@ -14,6 +14,8 @@ "options": [ "H5P.Text 1.1", "H5P.TextInputField 1.2", + "H5P.CheckboxList 1.0", + "H5P.DropdownField 1.0", "H5P.Image 1.1", "H5P.Accordion 1.0" ] diff --git a/standard-page.js b/standard-page.js index 2affff6..5764acd 100644 --- a/standard-page.js +++ b/standard-page.js @@ -120,7 +120,10 @@ H5P.StandardPage = (function ($, EventDispatcher) { StandardPage.prototype.getInputArray = function () { var inputArray = []; this.pageInstances.forEach(function (elementInstance) { - if (elementInstance.libraryInfo.machineName === 'H5P.TextInputField') { + if ( + ['H5P.TextInputField', 'H5P.CheckboxList', 'H5P.DropdownField'] + .includes(elementInstance.libraryInfo.machineName) + ) { inputArray.push(elementInstance.getInput()); } }); @@ -135,7 +138,10 @@ H5P.StandardPage = (function ($, EventDispatcher) { StandardPage.prototype.requiredInputsIsFilled = function () { var requiredInputsIsFilled = true; this.pageInstances.forEach(function (elementInstance) { - if (elementInstance.libraryInfo.machineName === 'H5P.TextInputField') { + if ( + ['H5P.TextInputField', 'H5P.CheckboxList', 'H5P.DropdownField'] + .includes(elementInstance.libraryInfo.machineName) + ) { if (!elementInstance.isRequiredInputFilled()) { requiredInputsIsFilled = false; } @@ -150,7 +156,10 @@ H5P.StandardPage = (function ($, EventDispatcher) { */ StandardPage.prototype.markRequiredInputFields = function () { this.pageInstances.forEach(function (elementInstance) { - if (elementInstance.libraryInfo.machineName === 'H5P.TextInputField') { + if ( + ['H5P.TextInputField', 'H5P.CheckboxList', 'H5P.DropdownField'] + .includes(elementInstance.libraryInfo.machineName) + ) { if (!elementInstance.isRequiredInputFilled()) { elementInstance.markEmptyField(); }