From 7509c329d625b5b1931007a8dee6e6d87512d2e5 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 11 Jun 2020 09:57:18 -0500 Subject: [PATCH] fix editor scroll bar on first load It seems that some container of the Editor component is breaking the resize calculation when the page firsts loads. So we have to be bit hacky and defer the call the resize until after all components have been rendered. --- src/components/Editor.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 8db3e283..9d0b5cea 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -49,6 +49,9 @@ class Editor extends React.Component { componentDidMount(): void { window.addEventListener('storage', this.onStorage); + // scroll bar is broken unless we do this when there is an ancestor + // that resizes things during load. + setTimeout(() => this.editorRef.current?.editor.resize(), 0); } componentWillUnmount(): void {