diff --git a/src/editors/containers/ProblemEditor/data/OLXParser.js b/src/editors/containers/ProblemEditor/data/OLXParser.js index 2a7af7dcd..9ce0e6f28 100644 --- a/src/editors/containers/ProblemEditor/data/OLXParser.js +++ b/src/editors/containers/ProblemEditor/data/OLXParser.js @@ -28,6 +28,28 @@ export const nonQuestionKeys = [ 'textline', ]; +export const responseKeys = [ + 'multiplechoiceresponse', + 'numericalresponse', + 'optionresponse', + 'stringresponse', + 'choiceresponse', + 'multiplechoiceresponse', + 'truefalseresponse', + 'optionresponse', + 'numericalresponse', + 'stringresponse', + 'customresponse', + 'symbolicresponse', + 'coderesponse', + 'externalresponse', + 'formularesponse', + 'schematicresponse', + 'imageresponse', + 'annotationresponse', + 'choicetextresponse', +]; + export const stripNonTextTags = ({ input, tag }) => { const stripedTags = {}; Object.entries(input).forEach(([key, value]) => { @@ -313,12 +335,7 @@ export class OLXParser { }; const builder = new XMLBuilder(options); const problemArray = _.get(this.questionData[0], problemType) || this.questionData; - /* TODO: How do we uniquely identify the description? - In order to parse description, there should be two states - and settings should be introduced to edit the label and description. - In turn editing the settings update the state and then it can be added to - the parsed OLX. - */ + const questionArray = []; problemArray.forEach(tag => { const tagName = Object.keys(tag)[0]; @@ -327,6 +344,16 @@ export class OLXParser { throw new Error('Script Tag, reverting to Advanced Editor'); } questionArray.push(tag); + } else if (responseKeys.includes(tagName)) { + /*