From 9fc2384649d2b6d385623d2bf7b1fe4a7c4b232c Mon Sep 17 00:00:00 2001 From: btzr-io Date: Tue, 28 Jul 2020 01:11:28 -0500 Subject: [PATCH] fix changes not saving on edit mode --- ui/component/publishForm/view.jsx | 1 + ui/component/storyEditor/view.jsx | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/component/publishForm/view.jsx b/ui/component/publishForm/view.jsx index 5d3adfe30..21000dfe6 100644 --- a/ui/component/publishForm/view.jsx +++ b/ui/component/publishForm/view.jsx @@ -191,6 +191,7 @@ function PublishForm(props: Props) { updatePublishForm({ channel }); } + // Prompt a file dialog to save a backup file of the story to publish. function showSaveDialog() { return dialog.showSaveDialog(currentWindow, { filters: [{ name: 'Text', extensions: ['md', 'markdown', 'txt'] }], diff --git a/ui/component/storyEditor/view.jsx b/ui/component/storyEditor/view.jsx index 506afc5f9..9437a3e60 100644 --- a/ui/component/storyEditor/view.jsx +++ b/ui/component/storyEditor/view.jsx @@ -73,12 +73,22 @@ function StoryEditor(props: Props) { const { mime_type: mimeType } = fileInfo; // Editing same file (previously published) // User can use a different file to replace the content - if (!filePath && streamingUrl && mimeType === 'text/markdown') { + if (!filePath && !fileText && streamingUrl && mimeType === 'text/markdown') { setCurrentFileType(mimeType); updateEditorText(streamingUrl); } } - }, [uri, isStillEditing, filePath, fileInfo, setPrevFileText, updatePublishForm, streamingUrl, setCurrentFileType]); + }, [ + uri, + fileText, + filePath, + fileInfo, + streamingUrl, + isStillEditing, + setPrevFileText, + updatePublishForm, + setCurrentFileType, + ]); return (