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

fix multiple choice get updated node

parent e05d166a
No related branches found
No related tags found
No related merge requests found
Pipeline #57491 passed with stages
in 3 minutes and 9 seconds
......@@ -81,6 +81,17 @@ const CustomSwitch = ({ node, getPos }) => {
main.dispatch(tr);
};
const getUpdatedNode = () => {
let nodeFound = node;
const allNodes = getNodes(main);
allNodes.forEach(singNode => {
if (singNode.node.attrs.id === node.attrs.id) {
nodeFound = singNode;
}
});
return nodeFound;
};
return (
<YesNoSwitch
checked={checked}
......@@ -88,7 +99,7 @@ const CustomSwitch = ({ node, getPos }) => {
customProps={customProps}
handleChange={handleChange}
isEditable={isEditable}
node={node}
node={getUpdatedNode()}
/>
);
};
......
......@@ -46,6 +46,17 @@ const CustomSwitch = ({ node, getPos }) => {
});
};
const getUpdatedNode = () => {
let nodeFound = node;
const allNodes = getNodes(main);
allNodes.forEach(singNode => {
if (singNode.node.attrs.id === node.attrs.id) {
nodeFound = singNode;
}
});
return nodeFound;
};
return (
<TrueFalseSwitch
checked={checked}
......@@ -53,7 +64,7 @@ const CustomSwitch = ({ node, getPos }) => {
customProps={customProps}
handleChange={handleChange}
isEditable={isEditable}
node={node}
node={getUpdatedNode()}
/>
);
};
......
......@@ -61,7 +61,7 @@ const StyledIconWrong = styled(Icon)`
const TrueFalseSwitch = ({
customProps,
node,
node: { node },
isEditable,
handleChange,
checked,
......
......@@ -81,6 +81,17 @@ const CustomSwitch = ({ node, getPos }) => {
main.dispatch(tr);
};
const getUpdatedNode = () => {
let nodeFound = node;
const allNodes = getNodes(main);
allNodes.forEach(singNode => {
if (singNode.node.attrs.id === node.attrs.id) {
nodeFound = singNode;
}
});
return nodeFound;
};
return (
<TrueFalseSwitch
checked={checked}
......@@ -88,7 +99,7 @@ const CustomSwitch = ({ node, getPos }) => {
customProps={customProps}
handleChange={handleChange}
isEditable={isEditable}
node={node}
node={getUpdatedNode()}
/>
);
};
......
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