Skip to content
Snippets Groups Projects
Commit 2aa8855c authored by chris's avatar chris
Browse files

fix single correct answer mode

parent 5774f387
No related branches found
No related tags found
1 merge request!421Fix hhmi issues
......@@ -170,7 +170,7 @@ const Hhmi = () => {
value={content}
readonly={readOnly}
layout={HhmiLayout}
onChange={source => console.log(source)}
// onChange={source => console.log(source)}
/>
</>
);
......
......@@ -139,12 +139,14 @@ export default ({ node, view, getPos }) => {
const listener = event => {
if (event.code === 'Enter') {
event.preventDefault();
addOptionBtnRef.current.click();
if (addOptionBtnRef.current) addOptionBtnRef.current.click();
}
};
addOptionBtnRef.current.addEventListener('keydown', listener);
if (addOptionBtnRef.current)
addOptionBtnRef.current.addEventListener('keydown', listener);
return () => {
addOptionBtnRef.current.removeEventListener('keydown', listener);
if (addOptionBtnRef.current)
addOptionBtnRef.current.removeEventListener('keydown', listener);
};
}, []);
......
......@@ -69,7 +69,7 @@ const CustomSwitch = ({ node, getPos }) => {
});
} else if (
element.type.name === 'multiple_choice_single_correct' &&
element.attrs.correct
element.attrs[key]
) {
tr.setNodeMarkup(parentPosition + position + 1, undefined, {
...element.attrs,
......
......@@ -69,7 +69,7 @@ const CustomSwitch = ({ node, getPos }) => {
});
} else if (
element.type.name === 'true_false_single_correct' &&
element.attrs.correct
element.attrs[key]
) {
tr.setNodeMarkup(parentPosition + position + 1, undefined, {
...element.attrs,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment