Fix scrolling + codemirror render
This commit is contained in:
@@ -43,9 +43,7 @@ class DocumentEdit extends Component {
|
||||
}
|
||||
|
||||
onPreviewToggle = () => {
|
||||
// Force re-render to fix issues with
|
||||
// Codemirror cursor (gets out of sync)
|
||||
state.togglePreview(this.forceUpdate());
|
||||
state.togglePreview();
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -94,6 +92,7 @@ class DocumentEdit extends Component {
|
||||
onChange={ state.updateText }
|
||||
text={ state.text }
|
||||
replaceText={ state.replaceText }
|
||||
preview={ state.preview }
|
||||
/>
|
||||
</EditorPane>
|
||||
{ state.preview ? (
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
.paneContent {
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fullWidth {
|
||||
|
||||
@@ -83,9 +83,8 @@ const documentEditState = new class DocumentEditState {
|
||||
this.text = this.text.replace(args.original, args.new);
|
||||
}
|
||||
|
||||
@action togglePreview = (callback) => {
|
||||
@action togglePreview = () => {
|
||||
this.preview = !this.preview;
|
||||
callback();
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user