Skip to content

Commit

Permalink
fix: Avoid unexpectedly marking post content as unsaved
Browse files Browse the repository at this point in the history
The custom `editorHasChanges` implementation resulted in an
always-"dirty" state, even after saving changes via the "Update" or
"Save draft" buttons. This removal, results in the editor relying upon
the existing `editorHasChanges` implementation, which appears to be more
accurate.

https://github.com/wordpress-mobile/WordPress-iOS/blob/388dbb167b7ae6fd763ed4c90076dc94679a9dc6/WordPress/Classes/ViewRelated/Post/PostEditor.swift#L81-L83
  • Loading branch information
dcalhoun committed Jan 14, 2025
1 parent 1e120e3 commit 8c6c4c7
Showing 1 changed file with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,6 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
private let editorViewController: GutenbergKit.EditorViewController
private weak var autosaveTimer: Timer?

var editorHasChanges: Bool {
var changes = post.changes
// TODO: cleanup (+ it doesn't handle scenarios like load from a revision)
// - warning: it has to compare two version serialized using the same system
if editorViewController.initialContent != post.content {
changes.content = post.content
} else {
changes.content = nil // yes, it needs to be set to .none manually
}
return !changes.isEmpty
}

// TODO: remove (none of these APIs are needed for the new editor)
var autosaver = Autosaver(action: {})
func prepopulateMediaItems(_ media: [Media]) {}
Expand Down

0 comments on commit 8c6c4c7

Please sign in to comment.