fix changes not saving on edit mode

This commit is contained in:
btzr-io 2020-07-28 01:11:28 -05:00 committed by Sean Yesmunt
parent 2ff1fc024c
commit 9fc2384649
2 changed files with 13 additions and 2 deletions

View file

@ -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'] }],

View file

@ -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 (
<FormField