fix changes not saving on edit mode
This commit is contained in:
parent
2ff1fc024c
commit
9fc2384649
2 changed files with 13 additions and 2 deletions
|
@ -191,6 +191,7 @@ function PublishForm(props: Props) {
|
||||||
updatePublishForm({ channel });
|
updatePublishForm({ channel });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prompt a file dialog to save a backup file of the story to publish.
|
||||||
function showSaveDialog() {
|
function showSaveDialog() {
|
||||||
return dialog.showSaveDialog(currentWindow, {
|
return dialog.showSaveDialog(currentWindow, {
|
||||||
filters: [{ name: 'Text', extensions: ['md', 'markdown', 'txt'] }],
|
filters: [{ name: 'Text', extensions: ['md', 'markdown', 'txt'] }],
|
||||||
|
|
|
@ -73,12 +73,22 @@ function StoryEditor(props: Props) {
|
||||||
const { mime_type: mimeType } = fileInfo;
|
const { mime_type: mimeType } = fileInfo;
|
||||||
// Editing same file (previously published)
|
// Editing same file (previously published)
|
||||||
// User can use a different file to replace the content
|
// 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);
|
setCurrentFileType(mimeType);
|
||||||
updateEditorText(streamingUrl);
|
updateEditorText(streamingUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [uri, isStillEditing, filePath, fileInfo, setPrevFileText, updatePublishForm, streamingUrl, setCurrentFileType]);
|
}, [
|
||||||
|
uri,
|
||||||
|
fileText,
|
||||||
|
filePath,
|
||||||
|
fileInfo,
|
||||||
|
streamingUrl,
|
||||||
|
isStillEditing,
|
||||||
|
setPrevFileText,
|
||||||
|
updatePublishForm,
|
||||||
|
setCurrentFileType,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormField
|
<FormField
|
||||||
|
|
Loading…
Add table
Reference in a new issue