diff --git a/js/scorm/wrapper.js b/js/scorm/wrapper.js index 843317f2..95af54c7 100644 --- a/js/scorm/wrapper.js +++ b/js/scorm/wrapper.js @@ -78,6 +78,7 @@ class ScormWrapper { this.finishCalled = false; this.logger = Logger.getInstance(); this.scorm = pipwerks.SCORM; + this.maxCharLimitOverride = null /** * Prevent the Pipwerks SCORM API wrapper's handling of the exit status */ @@ -146,6 +147,9 @@ class ScormWrapper { if (_.isBoolean(settings._setCompletedWhenFailed)) { this.setCompletedWhenFailed = settings._setCompletedWhenFailed; } + if (!_.isNaN(settings._maxCharLimitOverride) && settings._maxCharLimitOverride > 0) { + this.maxCharLimitOverride = settings._maxCharLimitOverride; + } } this.logger.debug('ScormWrapper::initialize'); @@ -679,7 +683,7 @@ class ScormWrapper { recordInteractionFillIn(id, response, correct, latency, type) { - const maxLength = this.isSCORM2004() ? 250 : 255; + const maxLength = this.maxCharLimitOverride ?? this.isSCORM2004() ? 250 : 255; if (response.length > maxLength) { response = response.substr(0, maxLength); diff --git a/properties.schema b/properties.schema index 6af08562..7fd6eb6a 100644 --- a/properties.schema +++ b/properties.schema @@ -259,6 +259,15 @@ "validators": [], "help": "If enabled, `cmi.completion_status` will be set to \"completed\" if the assessment is \"failed\". Only valid for SCORM 2004, where the logic for completion and success is separate." }, + "_maxCharLimitOverride": { + "type": "number", + "required": false, + "default": "0", + "title": "Override value for maximum character limit on fill-in type answers", + "inputType": "Number", + "validators": ["number"], + "help": "If your LMS allows it, you may set a value to override the default character limit for fill-in answers (250 for SCORM2004, 255 for SCORM1.2)." + }, "_connectionTest": { "type": "object", "required": true, diff --git a/schema/config.schema.json b/schema/config.schema.json index 31b05043..ee81e043 100644 --- a/schema/config.schema.json +++ b/schema/config.schema.json @@ -95,10 +95,7 @@ "title": "SCORM version", "description": "The SCORM standard to use - SCORM 1.2 or SCORM 2004 4th Edition", "default": "1.2", - "enum": [ - "1.2", - "2004" - ], + "enum": ["1.2", "2004"], "_backboneForms": "Select" }, "_showDebugWindow": { @@ -159,24 +156,14 @@ "type": "string", "title": "Incomplete course exit status", "default": "auto", - "enum": [ - "auto", - "suspend", - "normal", - "" - ], + "enum": ["auto", "suspend", "normal", ""], "_backboneForms": "Select" }, "_exitStateIfComplete": { "type": "string", "title": "Complete course exit status", "default": "auto", - "enum": [ - "auto", - "suspend", - "normal", - "" - ], + "enum": ["auto", "suspend", "normal", ""], "_backboneForms": "Select" }, "_setCompletedWhenFailed": { @@ -185,6 +172,12 @@ "description": "If enabled, `cmi.completion_status` will be set to \"completed\" if the assessment is \"failed\". Only valid for SCORM 2004, where the logic for completion and success is separate.", "default": true }, + "_maxCharLimitOverride": { + "type": "number", + "title": "Override value for maximum character limit on fill-in type answers", + "description": "If your LMS allows it, you may set a value to override the default character limit for fill-in answers (250 for SCORM2004, 255 for SCORM1.2).", + "default": 0 + }, "_connectionTest": { "type": "object", "title": "Connection Test",