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

fix node update issues

parent b99449e3
No related branches found
No related tags found
1 merge request!317Inline nodeview
......@@ -120,11 +120,6 @@ const EditorComponent = ({ node, view, getPos }) => {
if (questionView.hasFocus()) questionView.focus();
},
},
handleKeyDown: (editoView, keyEvent) => {
if (keyEvent.key === 'Enter') {
console.log('create new');
}
},
attributes: {
spellcheck: 'false',
......
......@@ -56,11 +56,11 @@ export default ({ node, view, getPos }) => {
const saveFeedBack = () => {
const allNodes = getNodes(context.view.main);
allNodes.forEach(singNode => {
if (singNode.node.attrs.id === node.attrs.id) {
allNodes.forEach(singleNode => {
if (singleNode.node.attrs.id === node.attrs.id) {
context.view.main.dispatch(
context.view.main.state.tr.setNodeMarkup(getPos(), undefined, {
...node.attrs,
...singleNode.node.attrs,
feedback: feedBack,
}),
);
......
......@@ -37,12 +37,17 @@ const CustomSwitch = ({ node, getPos }) => {
const handleChange = () => {
setChecked(!checked);
context.view.main.dispatch(
context.view.main.state.tr.setNodeMarkup(getPos(), undefined, {
...node.attrs,
correct: !checked,
}),
);
const allNodes = getNodes(context.view.main);
allNodes.forEach(singleNode => {
if (singleNode.node.attrs.id === node.attrs.id) {
context.view.main.dispatch(
context.view.main.state.tr.setNodeMarkup(getPos(), undefined, {
...singleNode.node.attrs,
correct: !checked,
}),
);
}
});
};
return (
......
......@@ -4,9 +4,9 @@ const multipleChoiceContainerNode = {
class: { default: 'mutiple-choice' },
},
group: 'block',
// atom: true,
atom: true,
selectable: true,
draggable: false,
draggable: true,
content: 'multiple_choice+',
parseDOM: [
{
......
......@@ -19,7 +19,7 @@ const multipleChoiceNode = {
return {
id: dom.getAttribute('id'),
class: dom.getAttribute('class'),
correct: dom.getAttribute('correct'),
correct: JSON.parse(dom.getAttribute('correct').toLowerCase()),
feedback: dom.getAttribute('feedback'),
};
},
......
......@@ -333,7 +333,7 @@ export default css`
padding-top: 0px;
&:before {
bottom: 45px;
bottom: 25px;
content: 'Answer Group ' counter(multiple-question) '.';
counter-increment: multiple-question;
position: relative;
......@@ -345,8 +345,4 @@ export default css`
padding: 5px 5px 0 5px;
}
}
.mutiple-choice.ProseMirror-selectednode {
outline: none;
}
`;
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