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

Update WaxContext only when needed

parent fb37b116
No related branches found
No related tags found
1 merge request!117Current features fixes
......@@ -66,13 +66,14 @@ export default props => {
const state = view.state.apply(tr);
view.updateState(state);
context.updateView(
{
main: view
},
"main"
);
if (!tr.getMeta("fromOutsideView")) {
context.updateView(
{
main: view
},
"main"
);
}
props.onChange(state.doc.content);
};
......
......@@ -39,6 +39,11 @@ export default ({ node, view }) => {
node: { attrs: { id: noteId } }
});
//Set everytime the active view into context
setTimeout(() => {
context.updateView({}, noteId);
}, 200);
if (!tr.getMeta("fromOutside")) {
let outerTr = view.state.tr,
offsetMap = StepMap.offset(noteFound[0].pos + 1);
......@@ -47,11 +52,9 @@ export default ({ node, view }) => {
for (let j = 0; j < steps.length; j++)
outerTr.step(steps[j].map(offsetMap));
}
if (outerTr.docChanged) view.dispatch(outerTr);
//Set everytime the active view into context
context.updateView({}, noteId);
//
if (outerTr.docChanged)
view.dispatch(outerTr.setMeta("fromOutsideView", true));
}
},
handleDOMEvents: {
......
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