From 1b1ff7347dff4c54d7afbf81d40178e1234392fd Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 27 Apr 2020 12:53:58 +0200 Subject: [PATCH] MOBILE-3407 quiz: Fix drops in ddimageortext in Moodle 3.6 --- src/core/question/providers/helper.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/question/providers/helper.ts b/src/core/question/providers/helper.ts index 0cb77a0b0..7623ea747 100644 --- a/src/core/question/providers/helper.ts +++ b/src/core/question/providers/helper.ts @@ -275,10 +275,11 @@ export class CoreQuestionHelperProvider { question.initObjects = this.textUtils.parseJSON(initMatch, null); } - const amdRegExp = new RegExp('require\\(\\[["\']qtype_' + question.type + '/question["\']\\], ?' + - 'function\\(amd\\) ?\\{ ?amd\\.init\\((["\'](q|question-' + usageId + '-)' + question.slot + - '["\'].*?)\\);', 'm'); + const amdRegExp = new RegExp('require\\(\\[["\']qtype_' + question.type + '/question["\']\\],[^f]*' + + 'function\\(amd\\)[^\\{]*\\{[^a]*amd\\.init\\((["\'](q|question-' + usageId + '-)' + question.slot + + '["\'].*)\\);', 'm'); const amdMatch = match.match(amdRegExp); + if (amdMatch) { // Try to convert the arguments to an array and add them to the question. question.amdArgs = this.textUtils.parseJSON('[' + amdMatch[1] + ']', null);