Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg Mobile: Emit save event to Gutenberg upon preview #20571

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega
}

func toggleEditingMode() {
emitPostSaveEvent()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe emitting save event is warranted here as the app needs to have a "snapshot" of Gutenberg's content before toggling to a different mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant about sending this event here because we're not strictly saving the post. I understand it solves the problem related to not saving the VideoPress block settings, but I'm concerned that in the future, we use this event for other purposes and this introduces an undesired side effect. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following our discussion on this, and the discovery that this is an issue on the web, I've gone ahead to revert this change in c653367.

gutenberg.toggleHTMLMode()
mode.toggle()
editorSession.switch(editor: analyticsEditor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ extension PostEditor {
return
}

emitPostSaveEvent()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially attempted to call this within the savePostBeforePreview function, but this resulted in the event being sent too late.


savePostBeforePreview() { [weak self] previewURLString, error in
guard let self = self else {
return
Expand Down