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

notes fix

parent 5327d6f9
No related branches found
No related tags found
1 merge request!235Images
...@@ -32,8 +32,6 @@ export default props => { ...@@ -32,8 +32,6 @@ export default props => {
state: EditorState.create(options), state: EditorState.create(options),
dispatchTransaction, dispatchTransaction,
user, user,
scrollMargin: 200,
scrollThreshold: 200,
handleDOMEvents: { handleDOMEvents: {
blur: onBlur blur: onBlur
? view => { ? view => {
......
...@@ -19,6 +19,7 @@ export default ({ node, view }) => { ...@@ -19,6 +19,7 @@ export default ({ node, view }) => {
const noteId = node.attrs.id; const noteId = node.attrs.id;
let noteView; let noteView;
let clickInNote = false; let clickInNote = false;
let typing = false;
// eslint-disable-next-line react/destructuring-assignment // eslint-disable-next-line react/destructuring-assignment
const isEditable = context.view.main.props.editable(editable => { const isEditable = context.view.main.props.editable(editable => {
return editable; return editable;
...@@ -45,6 +46,9 @@ export default ({ node, view }) => { ...@@ -45,6 +46,9 @@ export default ({ node, view }) => {
if (noteView.hasFocus()) noteView.focus(); if (noteView.hasFocus()) noteView.focus();
}, },
}, },
handleTextInput: (editorView, from, to, text) => {
typing = true;
},
transformPasted: slice => { transformPasted: slice => {
return transformPasted(slice, noteView); return transformPasted(slice, noteView);
}, },
...@@ -98,6 +102,12 @@ export default ({ node, view }) => { ...@@ -98,6 +102,12 @@ export default ({ node, view }) => {
context.updateView({}, noteId); context.updateView({}, noteId);
}, 20); }, 20);
const findReplace = context.app.PmPlugins.get('findAndReplacePlugin');
const matches = findReplace.getState(noteView.state).allMatches;
if (matches.length > 0 && !typing) context.updateView({}, noteId);
typing = false;
// UNTIL HERE
if (!tr.getMeta('fromOutside')) { if (!tr.getMeta('fromOutside')) {
const outerTr = view.state.tr; const outerTr = view.state.tr;
const offsetMap = StepMap.offset(noteFound[0].pos + 1); const offsetMap = StepMap.offset(noteFound[0].pos + 1);
...@@ -108,7 +118,7 @@ export default ({ node, view }) => { ...@@ -108,7 +118,7 @@ export default ({ node, view }) => {
} }
if (outerTr.docChanged) if (outerTr.docChanged)
view.dispatch(outerTr.setMeta('outsideView', 'notes')); view.dispatch(outerTr.setMeta('outsideView', noteId));
} }
}; };
......
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