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

fix activeView

parent d8b2ef41
No related branches found
No related tags found
1 merge request!359new node structure
...@@ -5,12 +5,12 @@ import MenuButton from '../ui/buttons/MenuButton'; ...@@ -5,12 +5,12 @@ import MenuButton from '../ui/buttons/MenuButton';
const Button = ({ view = {}, item }) => { const Button = ({ view = {}, item }) => {
const { active, icon, label, run, select, title } = item; const { active, icon, label, run, select, title } = item;
const context = useContext(WaxContext);
const { const {
view: { main }, view: { main },
activeViewId, activeViewId,
activeView, activeView,
} = useContext(WaxContext); } = context;
const isEditable = main.props.editable(editable => { const isEditable = main.props.editable(editable => {
return editable; return editable;
...@@ -44,7 +44,7 @@ const Button = ({ view = {}, item }) => { ...@@ -44,7 +44,7 @@ const Button = ({ view = {}, item }) => {
title={title} title={title}
/> />
), ),
[isActive, isDisabled], [isActive, isDisabled, activeViewId],
); );
return MenuButtonComponent; return MenuButtonComponent;
......
...@@ -93,7 +93,7 @@ const ImageUpload = ({ item, fileUpload, view }) => { ...@@ -93,7 +93,7 @@ const ImageUpload = ({ item, fileUpload, view }) => {
</label> </label>
</Wrapper> </Wrapper>
), ),
[isDisabled], [isDisabled, activeViewId],
); );
return ImageUploadComponent; return ImageUploadComponent;
......
...@@ -96,10 +96,10 @@ class EssayQuestion extends Tools { ...@@ -96,10 +96,10 @@ class EssayQuestion extends Tools {
tr.replaceSelectionWith(essayAnswer); tr.replaceSelectionWith(essayAnswer);
dispatch(tr); dispatch(tr);
// setTimeout(() => { setTimeout(() => {
// createEmptyParagraph(context, essayQuestion.attrs.id); createEmptyParagraph(context, essayAnswer.attrs.id);
// createEmptyParagraph(context, essayAnswer.attrs.id); createEmptyParagraph(context, essayQuestion.attrs.id);
// }, 50); }, 50);
}; };
} }
......
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
liftListItem, liftListItem,
sinkListItem, sinkListItem,
} from 'prosemirror-schema-list'; } from 'prosemirror-schema-list';
import Placeholder from '../plugins/placeholder'; import Placeholder from '../../MultipleChoiceQuestionService/plugins/placeholder';
const EditorWrapper = styled.div` const EditorWrapper = styled.div`
border: none; border: none;
......
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
liftListItem, liftListItem,
sinkListItem, sinkListItem,
} from 'prosemirror-schema-list'; } from 'prosemirror-schema-list';
import Placeholder from '../plugins/placeholder'; import Placeholder from '../../MultipleChoiceQuestionService/plugins/placeholder';
const EditorWrapper = styled.div` const EditorWrapper = styled.div`
border: none; border: none;
...@@ -150,6 +150,9 @@ const EssayQuestionComponent = ({ node, view, getPos }) => { ...@@ -150,6 +150,9 @@ const EssayQuestionComponent = ({ node, view, getPos }) => {
if (essayQuestionView.hasFocus()) essayQuestionView.focus(); if (essayQuestionView.hasFocus()) essayQuestionView.focus();
}, },
}, },
handleClickOn: () => {
context.updateView({}, questionId);
},
attributes: { attributes: {
spellcheck: 'false', spellcheck: 'false',
......
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