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

remove option from node

parent 07f1be3a
No related branches found
No related tags found
No related merge requests found
...@@ -81,7 +81,6 @@ const DropComponent = ({ getPos, node, view, uniqueId }) => { ...@@ -81,7 +81,6 @@ const DropComponent = ({ getPos, node, view, uniqueId }) => {
const isEditable = main.props.editable(editable => { const isEditable = main.props.editable(editable => {
return editable; return editable;
}); });
let isDisabled = !isEditable; let isDisabled = !isEditable;
if (node.attrs.options.length === 0) isDisabled = true; if (node.attrs.options.length === 0) isDisabled = true;
......
...@@ -220,6 +220,24 @@ export default ({ node, view, getPos }) => { ...@@ -220,6 +220,24 @@ export default ({ node, view, getPos }) => {
setTimeout(() => { setTimeout(() => {
setAddingOption(false); setAddingOption(false);
}); });
const allNodes = getNodes(context.pmViews.main);
allNodes.forEach(singleNode => {
if (singleNode.node.attrs.id === node.attrs.id) {
singleNode.node.content.content.forEach(parentNodes => {
parentNodes.forEach(optionNode => {
if (optionNode.type.name === 'matching_option') {
/* eslint-disable-next-line no-param-reassign */
optionNode.attrs.options = options.filter(
option => option.value !== value,
);
if (optionNode.attrs.correct === value) {
optionNode.attrs.correct = '';
}
}
});
});
}
});
}; };
const saveInChildOptions = allNodes => { const saveInChildOptions = allNodes => {
......
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