From 3691ae4d136d30747f92a94606c4b2db4c5c2c25 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 19 Feb 2018 18:56:56 +0000 Subject: [PATCH] Electron: Fixes #217: Display a message when the note has no content and only the note viewer is visible --- ElectronClient/app/gui/NoteText.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/gui/NoteText.jsx b/ElectronClient/app/gui/NoteText.jsx index 2beb6b13c..b10b73f1a 100644 --- a/ElectronClient/app/gui/NoteText.jsx +++ b/ElectronClient/app/gui/NoteText.jsx @@ -600,7 +600,14 @@ class NoteTextComponent extends React.Component { }, postMessageSyntax: 'ipcRenderer.sendToHost', }; - const html = this.mdToHtml().render(body, theme, mdOptions); + + let bodyToRender = body; + if (!bodyToRender.trim() && visiblePanes.indexOf('viewer') >= 0 && visiblePanes.indexOf('editor') < 0) { + // Fixes https://github.com/laurent22/joplin/issues/217 + bodyToRender = '*' + _('This not has no content. Click on "%s" to toggle the editor and edit the note.', _('Layout')) + '*'; + } + + const html = this.mdToHtml().render(bodyToRender, theme, mdOptions); this.webview_.send('setHtml', html); }