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

fix focus in all views

parent 04165dd4
No related branches found
No related tags found
1 merge request!374Add feedback
This commit is part of merge request !374. Comments created here will be created in the context of that merge request.
......@@ -20,6 +20,10 @@ const NoteEditorContainerStyled = styled.div`
padding-bottom: 5px;
margin-right: 0;
}
*::selection {
background-color: #c5d7fe;
color: #000;
}
`;
const NoteStyled = styled.div`
......
......@@ -16,10 +16,12 @@ const Button = ({ view = {}, item }) => {
const handleMouseDown = (e, editorState, editorDispatch) => {
e.preventDefault();
options.fullScreen = !options.fullScreen;
const { selection } = editorState;
activeView.dispatch(
activeView.state.tr.setSelection(
new TextSelection(activeView.state.tr.doc.resolve(selection.from)),
TextSelection.between(
activeView.state.selection.$anchor,
activeView.state.selection.$head,
),
),
);
activeView.focus();
......
......@@ -149,6 +149,11 @@ const EssayAnswerComponent = ({ node, view, getPos }) => {
// the parent editor is focused.
if (essayAnswerView.hasFocus()) essayAnswerView.focus();
},
blur: (editorView, event) => {
if (essayAnswerView && event.relatedTarget === null) {
essayAnswerView.focus();
}
},
},
attributes: {
......
......@@ -149,6 +149,11 @@ const EssayQuestionComponent = ({ node, view, getPos }) => {
// the parent editor is focused.
if (essayQuestionView.hasFocus()) essayQuestionView.focus();
},
blur: (editorView, event) => {
if (essayQuestionView && event.relatedTarget === null) {
essayQuestionView.focus();
}
},
},
handleClickOn: () => {
context.updateView({}, questionId);
......
......@@ -47,7 +47,7 @@ export default ({ node, view }) => {
dispatchTransaction,
disallowedTools: ['Tables', 'Images'],
handleDOMEvents: {
blur: () => {
blur: (editorView, event) => {
if (context.view[noteId]) {
context.view[noteId].dispatch(
context.view[noteId].state.tr.setSelection(
......
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