From 1a2e3a17dd53bd0e37569914f94a5f552c3bfb40 Mon Sep 17 00:00:00 2001 From: KMcB Date: Mon, 8 Oct 2018 18:40:34 +0200 Subject: [PATCH] fix detectOldSyntax button appearance --- src/components/FileEditor/index.js | 6 +++--- src/components/FilesList/index.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/FileEditor/index.js b/src/components/FileEditor/index.js index e2b4b944..f3fac595 100644 --- a/src/components/FileEditor/index.js +++ b/src/components/FileEditor/index.js @@ -143,9 +143,7 @@ class FileEditor extends Component { detecteOldSyntax = () => { const content = this.getContent() - if (isOldSyntax(content)) { - this.props.onDetectOldSyntax() - } + this.props.onDetectOldSyntax(isOldSyntax(content)) } async loadContent() { @@ -253,6 +251,8 @@ class FileEditor extends Component { await fsWriteFile(fileName, mjml) setPreview(fileName, mjml) } + + window.requestIdleCallback(this.detecteOldSyntax) }, 200) getContent = () => { diff --git a/src/components/FilesList/index.js b/src/components/FilesList/index.js index 9c5fac4e..f910ba4c 100644 --- a/src/components/FilesList/index.js +++ b/src/components/FilesList/index.js @@ -85,7 +85,7 @@ class FilesList extends Component { ipcRenderer.removeListener('browser-window-focus', this.refresh) } - handleDetectOldSyntax = () => this.setState({ isOldSyntaxDetected: true }) + handleDetectOldSyntax = val => this.setState({ isOldSyntaxDetected: val }) handleSubmit = e => { e.preventDefault()