From c53deb9e3eb8c7d5a6190f952403b35f14656f8b Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Mon, 16 May 2022 15:34:47 +0300 Subject: [PATCH] start editoria --- editors/demo/src/Editors.js | 2 +- editors/demo/src/HHMI/HHMI.js | 2 +- .../components/ContainerEditor.js | 11 ++--------- .../components/DropDownComponent.js | 4 +--- .../components/ReadOnlyDropDown.js | 6 +++++- .../schema/multipleDropDownContainerNode.js | 3 +-- 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/editors/demo/src/Editors.js b/editors/demo/src/Editors.js index 1e839e3d3..166168897 100644 --- a/editors/demo/src/Editors.js +++ b/editors/demo/src/Editors.js @@ -70,7 +70,7 @@ const Editors = () => { case 'ncbi': return <NCBI />; default: - return <HHMI />; + return <Editoria />; } }; diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js index af3923bc6..1b8623619 100644 --- a/editors/demo/src/HHMI/HHMI.js +++ b/editors/demo/src/HHMI/HHMI.js @@ -28,7 +28,7 @@ const SubmitButton = styled.button` top: 16px; `; -const t = `<div id="1624fa06-2075-488a-9912-9794a3763aca" class="multiple-drop-down-container" feedback=""> +const t = `<p class="paragraph"></p><div id="1624fa06-2075-488a-9912-9794a3763aca" class="multiple-drop-down-container" feedback=""> <p class="paragraph">Lorem ipsum dolor sit amet,<span id="fa9ff44d-19a6-4f47-99d9-d77d3dc02fbf" class="multiple-drop-down-option" options="[{"label":"option 1","value":"6c4aa0f3-43b1-40a7-a066-bc73449523df"},{"label":"option 2","value":"29365b0c-c00d-40c1-8a5e-118dbdf47e50"},{"label":"option 3","value":"743a425e-6340-4a72-a07c-d2e78154fcc8"}]" correct="29365b0c-c00d-40c1-8a5e-118dbdf47e50"></span>consectetur adipiscing elit. Nulla cursus ultricies enim, id condimentum dui facilisis a. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed euismod posuere orci. Praesent consectetur augue ut lorem suscipit, nec molestie libero pellentesque. </p> <p class="paragraph">Nullam porttitor ligula neque. In aliquam<span id="f8380222-11fa-46e7-91a9-0bf67ff3d1d7" class="multiple-drop-down-option" options="[{"label":"option 4","value":"4e2c45fe-0aad-4c59-9a92-ed44f01a82e2"},{"label":"option 5","value":"15e27b91-682a-4e10-a5d0-149192fd2e4c"},{"label":"option 6","value":"886c921d-2e75-41ea-a1a6-2d49e7921a57"},{"label":"option 7","value":"d14c2409-f66a-47d1-8f63-72686d24df37"}]" correct="4e2c45fe-0aad-4c59-9a92-ed44f01a82e2"></span> ex neque, sit amet sagittis nulla volutpat sed. Nulla blandit facilisis ante, vel tempus ante porta quis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer nulla tellus, dictum at laoreet eu, hendrerit at quam. Sed consectetur, neque vel ornare malesuada, eros sem commodo purus, <span id="c13f5243-03c0-433c-8e44-440d536d9150" class="multiple-drop-down-option" options="[{"label":"option 9","value":"3b9cd3b4-9e70-45de-975d-31407c48812c"},{"label":"option 10","value":"3baf86a8-a3fa-4e64-bfe8-f01ce4320489"},{"label":"option 11","value":"f1c6023c-5cde-445a-b9fb-cc23f06c8132"}]" correct="f1c6023c-5cde-445a-b9fb-cc23f06c8132"></span> sagittis volutpat elit leo in diam. Aliquam mattis, est non placerat euismod, nisl nisl vestibulum mauris, non interdum dui urna et tellus.</p> </div> diff --git a/wax-prosemirror-services/src/MultipleDropDownService/components/ContainerEditor.js b/wax-prosemirror-services/src/MultipleDropDownService/components/ContainerEditor.js index 99bbcb393..52cd05c10 100644 --- a/wax-prosemirror-services/src/MultipleDropDownService/components/ContainerEditor.js +++ b/wax-prosemirror-services/src/MultipleDropDownService/components/ContainerEditor.js @@ -14,7 +14,7 @@ const EditorWrapper = styled.div` position: relative; > .ProseMirror { - padding: 5px; + padding: 5px !important; &:focus { outline: none; } @@ -85,14 +85,7 @@ const ContainerEditor = ({ node, view, getPos }) => { plugins: finalPlugins, }), dispatchTransaction, - disallowedTools: [ - 'Images', - 'Lists', - 'lift', - 'Tables', - 'FillTheGap', - 'MultipleChoice', - ], + disallowedTools: ['Images', 'FillTheGap', 'MultipleChoice'], handleDOMEvents: { mousedown: () => { main.dispatch( diff --git a/wax-prosemirror-services/src/MultipleDropDownService/components/DropDownComponent.js b/wax-prosemirror-services/src/MultipleDropDownService/components/DropDownComponent.js index 6c1dc27ff..3d5139ee4 100644 --- a/wax-prosemirror-services/src/MultipleDropDownService/components/DropDownComponent.js +++ b/wax-prosemirror-services/src/MultipleDropDownService/components/DropDownComponent.js @@ -101,8 +101,6 @@ export default ({ setPosition, position }) => { pmViews: { main }, } = context; - const customProps = main.props.customValues; - const isEditable = main.props.editable(editable => { return editable; }); @@ -123,7 +121,7 @@ export default ({ setPosition, position }) => { const WaxSurface = activeView.dom.getBoundingClientRect(); const start = activeView.coordsAtPos(from); const left = start.left - WaxSurface.left - 75; - const top = start.top - WaxSurface.top + 30; + const top = start.top - WaxSurface.top + 25; setPosition({ ...position, left, top }); }, [position.left]); diff --git a/wax-prosemirror-services/src/MultipleDropDownService/components/ReadOnlyDropDown.js b/wax-prosemirror-services/src/MultipleDropDownService/components/ReadOnlyDropDown.js index 8638a53c7..762112817 100644 --- a/wax-prosemirror-services/src/MultipleDropDownService/components/ReadOnlyDropDown.js +++ b/wax-prosemirror-services/src/MultipleDropDownService/components/ReadOnlyDropDown.js @@ -50,7 +50,11 @@ const DropComponent = ({ options }) => { pmViews: { main }, } = context; - const onChange = option => {}; + const customProps = main.props.customValues; + + const onChange = option => { + console.log(option); + }; useEffect(() => {}, []); diff --git a/wax-prosemirror-services/src/MultipleDropDownService/schema/multipleDropDownContainerNode.js b/wax-prosemirror-services/src/MultipleDropDownService/schema/multipleDropDownContainerNode.js index 83884cd92..0631cd913 100644 --- a/wax-prosemirror-services/src/MultipleDropDownService/schema/multipleDropDownContainerNode.js +++ b/wax-prosemirror-services/src/MultipleDropDownService/schema/multipleDropDownContainerNode.js @@ -5,10 +5,9 @@ const multipleDropDownContainerNode = { feedback: { default: '' }, }, group: 'block questions', - atom: true, selectable: false, draggable: false, - content: 'block*', + content: 'block+', parseDOM: [ { tag: 'div.multiple-drop-down-container', -- GitLab