Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions src/components/faq/FaqItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,7 @@ import {Collapse} from "react-collapse";
*/
const FaqItem = ({faq, index}) => {
const [isActive, setIsActive] = useState(false);
// const re = new RegExp('target="_blank"', 'gmi');

/* TODO */
/*
* the text editor for creating the FAQ does not add the rel = "noopener"
therefore DOMPurify.sanitize (faq.description) removes the target = "_ blank" from the images
* function array_move(arr, old_index, new_index) {
if (new_index >= arr.length) {
let k = new_index - arr.length + 1;
while (k--) {
arr.push(undefined);
}
}
arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
return arr; // for testing
};

const assignText = faq.description.split(' ').filter((e) => {
if (re.exec(e)) {
let j=array_move(e.split('>').concat('rel="noopener"'), 2, 1)
return j.join('>').replace('/>/',' ')
}else{
return e;
}
});
* */


const toggleActive = () => setIsActive(!isActive);

Expand Down
15 changes: 3 additions & 12 deletions src/components/faq/FaqList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ const FaqList = () => {
const isMounted = useRef(false);
const cancelSource = useMemo(() => axios.CancelToken.source(), []);

/**
* function that load all the questions from the API
* @function
*/

const loadQuestions = useCallback(async () => {
setDataload(0);
try {
Expand All @@ -48,18 +45,12 @@ const FaqList = () => {
}
}, [cancelSource]);

/**
* UseEffect that loads the questions
* @function
*/

useEffect(() => {
loadQuestions();
}, [loadQuestions]);

/**
* UseEffect that handles the mounting and unmounting and cancels requests
* @function
*/

useEffect(() => {
isMounted.current = true;
return () => {
Expand Down