mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 10:02:43 +00:00
Merge pull request #1874 from naturalcrit/BatchCodeMirrorHighlighting
Tell CodeMirror to batch custom highlights before updating the browser
This commit is contained in:
@@ -107,6 +107,7 @@ const Editor = createClass({
|
|||||||
if(this.state.view === 'text') {
|
if(this.state.view === 'text') {
|
||||||
const codeMirror = this.refs.codeEditor.codeMirror;
|
const codeMirror = this.refs.codeEditor.codeMirror;
|
||||||
|
|
||||||
|
codeMirror.operation(()=>{ // Batch CodeMirror styling
|
||||||
//reset custom text styles
|
//reset custom text styles
|
||||||
const customHighlights = codeMirror.getAllMarks().filter((mark)=>!mark.__isFold); //Don't undo code folding
|
const customHighlights = codeMirror.getAllMarks().filter((mark)=>!mark.__isFold); //Don't undo code folding
|
||||||
for (let i=customHighlights.length - 1;i>=0;i--) customHighlights[i].clear();
|
for (let i=customHighlights.length - 1;i>=0;i--) customHighlights[i].clear();
|
||||||
@@ -168,6 +169,7 @@ const Editor = createClass({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user