Skip to content

Commit

Permalink
Previously-saved files should be treated as unsaved even if blank
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkaney committed May 10, 2024
1 parent 64b40d4 commit f270e8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/desktop/src/main/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export class DesktopDocument extends EventEmitter<DocumentEvents> {
}

get needsSave() {
// Check for blank documents
// Check for blank, unsaved documents
if (
this.fileStatus.saved === false &&
!this.fileStatus.path &&
(!this.content || this.content.doc.eq(Text.empty))
) {
return false;
Expand Down
5 changes: 3 additions & 2 deletions app/desktop/src/renderer/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ export function fileSync(
}

export function getSaveStatus(state: EditorState) {
const { version, thisVersion, saved } = state.field(saveState);
const { version, thisVersion, path, saved } = state.field(saveState);

// Empty docs are never unsaved
if (state.doc.eq(Text.empty)) {
// TODO: Have this check be done in the main process
if (!path && state.doc.eq(Text.empty)) {
return true;
}

Expand Down

0 comments on commit f270e8f

Please sign in to comment.