Skip to content

Commit

Permalink
display images from url
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHabenicht committed Sep 11, 2021
1 parent ec20a29 commit 88c95e2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export const QuestionnaireExecution: React.FC<QuestionnaireExecutionProps> = ({
<Typography
className={classes.questionDetails}
dangerouslySetInnerHTML={{
__html: sanitizeHtml(currentQuestion.details),
__html: sanitizeHtml(currentQuestion.details, {
allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'img' ])
}),
}}
/>
</Grid>
Expand Down
4 changes: 3 additions & 1 deletion covquestions-editor-app/src/components/ResultComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export const ResultComponent: React.FC<{ results: Result[] }> = ({ results }) =>
<Typography
className={classes.resultText}
dangerouslySetInnerHTML={{
__html: sanitizeHtml(result.result.text),
__html: sanitizeHtml(result.result.text, {
allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'img' ])
}),
}}
/>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export function ElementEditorQuestion(props: QuestionElementEditorProps) {
const validate = (formData: QuestionInStringRepresentation, errors: any) => {
try {
convertStringToLogicExpression(formData.enableWhenExpressionString);
} catch (error) {
errors.enableWhenExpressionString.addError(error.message);
} catch (error: any) {
errors.enableWhenExpressionString.addError(error.message);
}
if (duplicatedIds.indexOf(formData.id) > -1) {
errors.id.addError("Value of ID is duplicated");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function ResultCategoryElementEditor(props: ResultElementEditorProps) {
const result = formData.results[i];
try {
convertStringToLogicExpression(result.expressionString);
} catch (error) {
} catch (error: any) {
errors.results[i].expressionString.addError(error.message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function VariableElementEditor(props: VariableElementEditorProps) {
const onValidate = (formData: VariableInStringRepresentation, errors: any) => {
try {
convertStringToLogicExpression(formData?.expressionString);
} catch (error) {
} catch (error: any) {
errors.expressionString.addError(error.message);
}

Expand Down

0 comments on commit 88c95e2

Please sign in to comment.