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

keep type per question

parent 832b25ec
No related branches found
No related tags found
1 merge request!511Numerical answer
......@@ -22,7 +22,8 @@ const NumericalAnswerContainerTool = styled.div`
border: 3px solid #f5f5f7;
border-bottom: none;
height: 33px;
display: flex;
flex-direction: row;
span:first-of-type {
position: relative;
top: 3px;
......@@ -39,9 +40,8 @@ const ActionButton = styled.button`
margin-top: 16px;
border: none;
position: relative;
bottom: 40px;
left: -11px;
float: right;
margin-left: auto;
bottom: 13px;
`;
const StyledIconActionRemove = styled(Icon)`
......@@ -55,7 +55,6 @@ export default ({ node, view, getPos }) => {
options,
pmViews: { main },
} = context;
const { numericalAnswer } = options;
const customProps = main.props.customValues;
const { testMode } = customProps;
......@@ -105,10 +104,16 @@ export default ({ node, view, getPos }) => {
view={view}
/>
<NumericalAnswerOption>
{!numericalAnswer && <>No Type Selected</>}
{numericalAnswer === 'exactAnswer' && <ExactAnswerComponent />}
{numericalAnswer === 'rangeAnswer' && <RangeAnswerComponent />}
{numericalAnswer === 'preciseAnswer' && <PreciseAnswerComponent />}
{!options[node.attrs.id] && <>No Type Selected</>}
{options[node.attrs.id]?.numericalAnswer === 'exactAnswer' && (
<ExactAnswerComponent />
)}
{options[node.attrs.id]?.numericalAnswer === 'rangeAnswer' && (
<RangeAnswerComponent />
)}
{options[node.attrs.id]?.numericalAnswer === 'preciseAnswer' && (
<PreciseAnswerComponent />
)}
</NumericalAnswerOption>
{!testMode && !(readOnly && feedback === '') && (
<FeedbackComponent
......
......@@ -69,7 +69,6 @@ const StyledIcon = styled(Icon)`
`;
const NumericalAnswerDropDownCompontent = ({ nodeId }) => {
console.log(nodeId);
const dropDownOptions = [
{
label: 'Exact answer with margin of error',
......@@ -157,7 +156,7 @@ const NumericalAnswerDropDownCompontent = ({ nodeId }) => {
};
const onChange = option => {
context.setOption({ numericalAnswer: option.value });
context.setOption({ [nodeId]: { numericalAnswer: option.value } });
main.dispatch(main.state.tr.setMeta('addToHistory', false));
setLabel(option.label);
openCloseMenu();
......
......@@ -3,6 +3,7 @@ const NumericalAnswerContainerNode = {
id: { default: '' },
class: { default: 'numerical-answer' },
feedback: { default: '' },
answerType: { default: '' },
},
group: 'block questions',
atom: true,
......
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