From 21eedf544a3b0f7978c8fc23c48b77b96f3a05b2 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 23 Nov 2020 08:43:16 +0100 Subject: [PATCH 1/2] MOBILE-2272 essay: Display attachments in review page --- src/addon/qtype/essay/component/addon-qtype-essay.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/addon/qtype/essay/component/addon-qtype-essay.html b/src/addon/qtype/essay/component/addon-qtype-essay.html index 6301a5be0..4876c04e0 100644 --- a/src/addon/qtype/essay/component/addon-qtype-essay.html +++ b/src/addon/qtype/essay/component/addon-qtype-essay.html @@ -27,9 +27,11 @@ - + - + + + From ab25f60482f643238344d802a03c9d4474867c93 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 23 Nov 2020 08:43:43 +0100 Subject: [PATCH 2/2] MOBILE-2272 essay: Don't format html if plain text --- src/addon/qtype/essay/providers/handler.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/addon/qtype/essay/providers/handler.ts b/src/addon/qtype/essay/providers/handler.ts index 6bbb4a7db..527b8505f 100644 --- a/src/addon/qtype/essay/providers/handler.ts +++ b/src/addon/qtype/essay/providers/handler.ts @@ -364,7 +364,19 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { question.html, this.questionHelper.getResponseFileAreaFiles(question, 'answer')); } - // Add some HTML to the text if needed. - answers[textarea.name] = this.textUtils.formatHtmlLines(answers[textarea.name]); + let isPlainText = false; + if (question.isPlainText !== undefined) { + isPlainText = question.isPlainText; + } else if (question.settings) { + isPlainText = question.settings.responseformat == 'monospaced' || question.settings.responseformat == 'plain'; + } else { + const questionEl = this.domUtils.convertToElement(question.html); + isPlainText = !!questionEl.querySelector('.qtype_essay_monospaced') || !!questionEl.querySelector('.qtype_essay_plain'); + } + + if (!isPlainText) { + // Add some HTML to the text if needed. + answers[textarea.name] = this.textUtils.formatHtmlLines(answers[textarea.name]); + } } }