From 854e356819ea8e23a78e55b66ba6fcddf50c645e Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Mon, 24 May 2021 19:43:21 +0300 Subject: [PATCH] temp --- editors/demo/src/Editoria/config/config.js | 2 +- editors/demo/src/Editors.js | 2 +- editors/demo/src/HHMI/HHMI.js | 2 +- .../FeedBackNodeView.js | 7 +++++++ .../MultipleChoiceQuestion.js | 1 + .../MultipleChoiceQuestionService.js | 14 ++++++++++++-- .../components/FeedbackComponent.js | 4 ++-- .../components/QuestionComponent.js | 2 ++ 8 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 editors/demo/src/HHMI/MultipleChoiceQuestionService/FeedBackNodeView.js diff --git a/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js index b428865c8..6b4c4ec42 100644 --- a/editors/demo/src/Editoria/config/config.js +++ b/editors/demo/src/Editoria/config/config.js @@ -60,7 +60,7 @@ import invisibles, { // }; const updateTitle = debounce(title => { - console.log(title); + // console.log(title); }, 3000); const saveTags = tags => { diff --git a/editors/demo/src/Editors.js b/editors/demo/src/Editors.js index fa52e3550..977ed5cc4 100644 --- a/editors/demo/src/Editors.js +++ b/editors/demo/src/Editors.js @@ -54,7 +54,7 @@ const Editors = () => { case 'ncbi': break; default: - return <Editoria />; + return <HHMI />; } }; diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js index 58e26fb8c..1baf671f6 100644 --- a/editors/demo/src/HHMI/HHMI.js +++ b/editors/demo/src/HHMI/HHMI.js @@ -183,7 +183,7 @@ const Hhmi = () => { config={config} autoFocus fileUpload={file => renderImage(file)} - value={initialValue} + value="" targetFormat="JSON" // readonly layout={HhmiLayout} diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/FeedBackNodeView.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/FeedBackNodeView.js new file mode 100644 index 000000000..67df88fe3 --- /dev/null +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/FeedBackNodeView.js @@ -0,0 +1,7 @@ +import { AbstractNodeView } from 'wax-prosemirror-services'; + +export default class FeedBackNodeView extends AbstractNodeView { + static name() { + return 'feedback'; + } +} diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js index 595fa2ac3..99c378f1b 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js @@ -12,6 +12,7 @@ class MultipleChoiceQuestion extends Tools { get run() { return (state, dispatch) => { + console.log(state); const { from, to } = state.selection; const { tr } = state; diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestionService.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestionService.js index f5feaeabb..5053c0221 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestionService.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestionService.js @@ -1,9 +1,11 @@ import { Service } from 'wax-prosemirror-services'; import MultipleChoiceQuestion from './MultipleChoiceQuestion'; import multipleChoiceNode from './schema/multipleChoiceNode'; +// import feedBackNode from './schema/feedBackNode'; import QuestionComponent from './components/QuestionComponent'; -import FeedbackComponent from './components/FeedbackComponent'; +// import FeedbackComponent from './components/FeedbackComponent'; import MultipleChoiceNodeView from './MultipleChoiceNodeView'; +// import FeedBackNodeView from './FeedBackNodeView'; class MultipleChoiceQuestionService extends Service { boot() {} @@ -16,6 +18,10 @@ class MultipleChoiceQuestionService extends Service { multiple_choice: multipleChoiceNode, }); + // createNode({ + // feedback: feedBackNode, + // }); + createNode({ question_wrapper: { group: 'block', @@ -47,7 +53,11 @@ class MultipleChoiceQuestionService extends Service { component: QuestionComponent, context: this.app, }); - // addPortal({ nodeView, component: FeedbackComponent, context: this.app }); + // addPortal({ + // nodeView: FeedBackNodeView, + // component: FeedbackComponent, + // context: this.app, + // }); } } diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js index e0e0c7af1..a2b4a4231 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js @@ -6,6 +6,6 @@ import { WaxContext } from 'wax-prosemirror-core'; import EditorComponent from './EditorComponent'; export default ({ node, view, getPos }) => { - console.log(node); - return null; + console.log(node, 'feedback'); + return <EditorComponent node={node} view={view} getPos={getPos} />; }; diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js index 8d12be66b..face78635 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { TextSelection } from 'prosemirror-state'; import { WaxContext } from 'wax-prosemirror-core'; import EditorComponent from './EditorComponent'; +import FeedbackComponent from './FeedbackComponent'; const QuestionWrapper = styled.div` display: flex; @@ -59,6 +60,7 @@ const Question = styled.div` `; export default ({ node, view, getPos }) => { + console.log(node); const context = useContext(WaxContext); const [showExplanation, setShowExplanation] = useState(false); const [explanationValue, setExplanationValue] = useState(''); -- GitLab