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

set readonly

parent 957d59a1
No related branches found
No related tags found
2 merge requests!293Inline question,!292Inline question
......@@ -30,17 +30,144 @@ const initialValue = {
content: [
{
type: 'text',
text: ' ',
text:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eros turpis, imperdiet viverra purus eget, ferment',
},
],
},
{
type: 'paragraph',
attrs: {
id: '',
class: 'paragraph',
track: [],
group: '',
viewid: '',
},
content: [
{
type: 'text',
text:
'um porttitor dui. Etiam quis venenatis risus, sit amet bibendum turpis. this is an addition Vestibulum non nibh at dolor sodales euismod. Maecenas mattis nulla in eros pretium, eu commodo sem sagittis. Nam eu v',
},
],
},
{
type: 'math_display',
content: [
{
type: 'text',
text: 'x+y = 1',
},
],
},
{
type: 'paragraph',
attrs: {
id: '',
class: 'paragraph',
track: [],
group: '',
viewid: '',
},
content: [
{
type: 'text',
text:
'arius justo. Nullam volutpat diam sit amet nunc aliquam convallis. Aliquam non eleifend dolor. Cras in urna lacinia, tempor tellus non, ',
},
],
},
{
type: 'question_wrapper',
attrs: {
class: 'question',
},
content: [
{
type: 'multiple_choice',
attrs: {
id: '7b6a992f-8a12-44b5-9112-67bfd80e053c',
},
content: [
{
type: 'text',
text: 'r ljjfljs dfljsdl jklkfj sr wrw',
},
],
},
{
type: 'multiple_choice',
attrs: {
id: '92c98be1-41a5-4c4c-bbba-747635df8878',
},
content: [
{
type: 'text',
text: 'fwefwrewr wwrrwe',
},
],
},
{
type: 'multiple_choice',
attrs: {
id: 'd51e74fb-a571-416e-82aa-2aef36f4218c',
},
content: [
{
type: 'text',
text: 'da;lf kfsdf l;',
},
{
type: 'math_inline',
content: [
{
type: 'text',
text: ' x+y=5',
},
],
},
{
type: 'text',
text: ' fk dfs;ldkf',
},
],
},
{
type: 'multiple_choice',
attrs: {
id: '03c71f12-3d95-4da8-8b13-71d77f3ce6a1',
},
content: [
{
type: 'text',
text: 'q f fwe r ',
},
{
type: 'math_inline',
content: [
{
type: 'text',
text:
' A = \\begin{bmatrix} x & y \\\\ z & w \\end{bmatrix} ',
},
],
},
{
type: 'text',
text: ' f’d fsd;f skf lfsd’fls f’fsdl',
},
],
},
{
type: 'multiple_choice',
attrs: {
id: '206bda35-858e-422d-a90d-164b7f460eb0',
id: '6e42010c-7c2d-4a55-a556-0691ac3e7d39',
},
content: [
{
type: 'text',
text: 'sss',
text: 'erw wr wrwer',
},
],
},
......@@ -58,7 +185,7 @@ const Hhmi = () => {
fileUpload={file => renderImage(file)}
value={initialValue}
targetFormat="JSON"
// readonly
readonly
layout={HhmiLayout}
onChange={source => console.log(source)}
/>
......
......@@ -15,11 +15,14 @@ const EditorComponent = ({ node, view, getPos }) => {
const context = useContext(WaxContext);
let questionView;
const questionId = node.attrs.id;
const isEditable = context.view.main.props.editable(editable => {
return editable;
});
useEffect(() => {
questionView = new EditorView(
{ mount: editorRef.current },
{
editable: () => isEditable,
state: EditorState.create({
doc: node,
plugins: [keymap(createKeyBindings()), ...context.app.getPlugins()],
......
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