Desktop: Fixes #9891: Don't rerender markdown notes when the note preview pane is hidden (#9901)

pull/9917/head
Henry Heino 2024-02-08 14:49:29 -08:00 committed by GitHub
parent 39b44ff439
commit 802f6c462e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -611,6 +611,10 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef<NoteBodyEditor
const timeoutId = shim.setTimeout(async () => {
let bodyToRender = props.content;
if (!props.visiblePanes.includes('viewer')) {
return;
}
if (!bodyToRender.trim() && props.visiblePanes.indexOf('viewer') >= 0 && props.visiblePanes.indexOf('editor') < 0) {
// Fixes https://github.com/laurent22/joplin/issues/217
bodyToRender = `<i>${_('This note has no content. Click on "%s" to toggle the editor and edit the note.', _('Layout'))}</i>`;

View File

@ -219,6 +219,10 @@ const CodeMirror = (props: NoteBodyEditorProps, ref: ForwardedRef<NoteBodyEditor
const timeoutId = shim.setTimeout(async () => {
let bodyToRender = props.content;
if (!props.visiblePanes.includes('viewer')) {
return;
}
if (!bodyToRender.trim() && props.visiblePanes.indexOf('viewer') >= 0 && props.visiblePanes.indexOf('editor') < 0) {
// Fixes https://github.com/laurent22/joplin/issues/217
bodyToRender = `<i>${_('This note has no content. Click on "%s" to toggle the editor and edit the note.', _('Layout'))}</i>`;