diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js index f9e2283cae44cc909b2e7f06e158bef7a4f5aa28..861d1a468377e04b1e949e0603879e98ed351fe4 100644 --- a/editors/demo/src/HHMI/HHMI.js +++ b/editors/demo/src/HHMI/HHMI.js @@ -25,7 +25,14 @@ const Hhmi = () => { fileUpload={file => renderImage(file)} value="" targetFormat="JSON" - nodeViews={[{ multiple_choice: { component: TestComponent } }]} + nodeViews={[ + { + multiple_choice: { + node: 'multiple_choice', + component: TestComponent, + }, + }, + ]} // readonly layout={HhmiLayout} // onChange={source => console.log(source)} diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js index e921c333d46a9a9c931f816e95b0caaab0c959c8..a363e1c99abbd0af746afe75961aaef11d024b37 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js @@ -1,6 +1,6 @@ import { injectable } from 'inversify'; import { Tools } from 'wax-prosemirror-services'; -import { wrapIn } from 'prosemirror-commands'; +import { setBlockType } from 'prosemirror-commands'; @injectable() class MultipleChoiceQuestion extends Tools { @@ -10,7 +10,7 @@ class MultipleChoiceQuestion extends Tools { get run() { return (state, dispatch) => { - wrapIn(state.config.schema.nodes.multiple_choice)(state, dispatch); + setBlockType(state.config.schema.nodes.multiple_choice)(state, dispatch); }; } diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js index da9539965a392d357c95670f570261b1a68f15fd..aa55a46283f7a9cd2db8607a772ff910d3412c2c 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js @@ -1,24 +1,24 @@ -// const multipleChoiceNode = { -// group: 'block multiple', -// content: 'text*', -// atom: true, -// code: true, -// toDOM: () => ['multiple-choice', { class: 'multiple-choice' }, 0], -// parseDOM: [ -// { -// tag: 'multiple-choice', -// }, -// ], -// }; - const multipleChoiceNode = { - content: 'block+', - group: 'block', - defining: true, - parseDOM: [{ tag: 'multiple-choice' }], - toDOM() { - return ['multiple-choice', 0]; - }, + group: 'block multiple', + content: 'text*', + atom: true, + code: true, + toDOM: () => ['multiple-choice', { class: 'multiple-choice' }, 0], + parseDOM: [ + { + tag: 'multiple-choice', + }, + ], }; +// const multipleChoiceNode = { +// content: 'block+', +// group: 'block', +// defining: true, +// // parseDOM: [{ tag: 'multiple-choice' }], +// toDOM() { +// // return ['multiple-choice', 0]; +// }, +// }; + export default multipleChoiceNode; diff --git a/wax-prosemirror-core/src/WaxView.js b/wax-prosemirror-core/src/WaxView.js index f12d4c69aeebf28d16640b29d7714c33115ae5da..1cb8c2e9da23879bbce6b7c3c15e3a9fab0093ab 100644 --- a/wax-prosemirror-core/src/WaxView.js +++ b/wax-prosemirror-core/src/WaxView.js @@ -85,9 +85,9 @@ export default props => { ); const createNodeVies = () => { - const test = nodeViews.map((nodeView, key) => { + const test = nodeViews.map((nodeView, key, index) => { return { - multiple_choice(node, view, getPos, decorations) { + [nodeView.multiple_choice.node](node, view, getPos, decorations) { console.log('rerenders for ever'); return createReactNodeView({ node,