diff --git a/app/components/Editor/Editor.js b/app/components/Editor/Editor.js
index 98ef5fbcc..8cada448e 100644
--- a/app/components/Editor/Editor.js
+++ b/app/components/Editor/Editor.js
@@ -40,6 +40,7 @@ class MarkdownEditor extends Component {
renderNode: SlateNodeProps => *;
plugins: Plugin[];
@observable editorValue: Value;
+ @observable editorLoaded: boolean = false;
constructor(props: Props) {
super(props);
@@ -70,6 +71,12 @@ class MarkdownEditor extends Component {
}
}
+ setEditorRef = (ref: Editor) => {
+ this.editor = ref;
+ // Force re-render to show ToC ()
+ this.editorLoaded = true;
+ };
+
onChange = (change: Change) => {
if (this.editorValue !== change.value) {
this.props.onChange(Markdown.serialize(change.value));
@@ -179,7 +186,9 @@ class MarkdownEditor extends Component {
>
- {readOnly && this.editor && }
+ {readOnly &&
+ this.editorLoaded &&
+ this.editor && }
{!readOnly &&
this.editor && (
@@ -192,7 +201,7 @@ class MarkdownEditor extends Component {
/>
)}
(this.editor = ref)}
+ innerRef={this.setEditorRef}
placeholder="Start with a title…"
bodyPlaceholder="…the rest is your canvas"
plugins={this.plugins}