diff --git a/Survey/package-lock.json b/Survey/package-lock.json index cede7625..d1a75991 100644 --- a/Survey/package-lock.json +++ b/Survey/package-lock.json @@ -30,7 +30,6 @@ "react-scripts": "5.0.1", "remark-emoji": "^2.2.0", "remark-gfm": "^1.0.0", - "remark-sub-super": "^1.0.20", "typescript": "^5.3.3", "util": "^0.12.5", "web-vitals": "^2.1.4", @@ -15961,11 +15960,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-sub-super": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/remark-sub-super/-/remark-sub-super-1.0.20.tgz", - "integrity": "sha512-ohnGWuB8FSvod8Qp+gEo/7QRDlI2RA8d+YyY4eLuMQPD3WGwqGMCuyWdNOSW0mzDMqse82PJqeke/GGXaj795A==" - }, "node_modules/renderkid": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", diff --git a/Survey/package.json b/Survey/package.json index 9383eeca..275604c4 100644 --- a/Survey/package.json +++ b/Survey/package.json @@ -25,7 +25,6 @@ "react-scripts": "5.0.1", "remark-emoji": "^2.2.0", "remark-gfm": "^1.0.0", - "remark-sub-super": "^1.0.20", "typescript": "^5.3.3", "util": "^0.12.5", "web-vitals": "^2.1.4", diff --git a/Survey/src/components/SurveyQuestions.tsx b/Survey/src/components/SurveyQuestions.tsx index 41fd8f41..c4adc16c 100644 --- a/Survey/src/components/SurveyQuestions.tsx +++ b/Survey/src/components/SurveyQuestions.tsx @@ -46,7 +46,6 @@ import ReactMarkdown from "react-markdown" import emoji from "remark-emoji" import gfm from "remark-gfm" import { useSnackbar } from "notistack" -import remarkSubSuper from 'remark-sub-super' import ConfirmationDialog from "./ConfirmationDialog" const GreenCheckbox = withStyles({ root: { @@ -305,6 +304,7 @@ const useStyles = makeStyles((theme) => ({ "& fieldset": { borderWidth: 0 }, }, required : { + "& span" : { color: "red"}, "& sup" : { color: "red"} }, sliderResponse: { @@ -448,7 +448,9 @@ function RateAnswer({ checked, onChange, value }) { return (
onChange(value)} className={checked ? classes.checkedContainer : classes.uncheckContainer}> {checked && - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> } @@ -503,12 +505,16 @@ function RadioOption({ onChange, options, value, ...props }) { variant="body2" style={{ color: selectedValue === `${x.value}` ? "black" : "rgba(0, 0, 0, 0.7)" }} > - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -785,7 +791,9 @@ function RadioRating({ onChange, options, value, mtValue, type, ...props }) { /> {type !== "matrix" && ( - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}}/> @@ -876,20 +884,24 @@ function Rating({ onChange, options, value, ...props }) { - { - return {props.children}; + : options[0].description} skipHtml={false} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, sub: (props) => { + return {props?.children}; + }, sup: (props) => { + return {props?.children}; }}} /> {options.length > 2 && ( - { + : options[Math.ceil(options.length / 2) - 1].description} skipHtml={false} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, sub: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -897,9 +909,11 @@ function Rating({ onChange, options, value, ...props }) { - { + : options[options.length - 1].description} skipHtml={false} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, sub: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -911,7 +925,9 @@ function Rating({ onChange, options, value, ...props }) { {t("Your response")}: - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -957,7 +973,9 @@ function Matrix({ x, responses, onResponse, activityId, total,index, idx,startTi - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -970,7 +988,9 @@ function Matrix({ x, responses, onResponse, activityId, total,index, idx,startTi {null} {(x.options || []).map((x) => ( - {(x.description || "").length > 0 && { + {(x.description || "").length > 0 && { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} />} @@ -981,7 +1001,9 @@ function Matrix({ x, responses, onResponse, activityId, total,index, idx,startTi {null} {(x.options || []).map((x) => ( - 0 && (x.value || "").length > 0 ? `(${t(x.value?.toString())})` : `${t(x.value?.toString())}`} escapeHtml={false} plugins={[gfm, emoji, remarkSubSuper]} renderers={{ link: LinkRenderer, sub: 'sub', sup: (props) => { + 0 && (x.value || "").length > 0 ? `(${t(x.value?.toString())})` : `${t(x.value?.toString())}`} skipHtml={false} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, sub: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -990,7 +1012,9 @@ function Matrix({ x, responses, onResponse, activityId, total,index, idx,startTi {(x.questions || []).map((question, qindex) => ( - { + *" : "")} allowDangerousHtml={true} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, span: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -1181,12 +1205,16 @@ function MultiSelectResponse({ onChange, options, value, ...props }) { variant="body2" style={{ color: selection.includes(`${x.value}`) ? "black" : "rgba(0, 0, 0, 0.7)" }} > - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -1265,14 +1293,16 @@ function Question({ onResponse, text, desc, required, type, options, value, star - { + *" : ""))} allowDangerousHtml={true} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, span: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> - 0 @@ -1285,7 +1315,9 @@ function Question({ onResponse, text, desc, required, type, options, value, star : options[options.length - 1].value }` ) - : !!desc && t(`${desc}`) } escapeHtml={false} plugins={[gfm, emoji, remarkSubSuper]} renderers={{ link: LinkRenderer, sub: 'sub', sup: (props) => { + : !!desc && t(`${desc}`) } skipHtml={false} plugins={[gfm, emoji]} renderers={{ link: LinkRenderer, sub: (props) => { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} /> @@ -1541,7 +1573,9 @@ function Section({ arrow_back } - { + { + return {props?.children}; + }, sup: (props) => { return {props.children}; }}} />