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

chore: show toast info banner when save hotkey used with no changes #6366

Merged
merged 2 commits into from
May 21, 2024

Conversation

JessChowdhury
Copy link
Member

Description

Closes #214.

If hotkey cmd+s is pressed when the document has no changes, it opens the browser save dialogue. This change displays a toast info banner with No changes to save.

PR for 2.0 is here.

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Chore (non-breaking change which does not add functionality)

Checklist:

  • Existing test suite passes locally with my changes

@jacobsfletch
Copy link
Member

I'm not sure we should display anything at all here tbh. I think most apps would simply do nothing. Notifying the user of an event that didn't happen feels unnecessary. What do you think? Might just be a matter of returning false in those handlers to achieve this.

@JessChowdhury
Copy link
Member Author

I'm not sure we should display anything at all here tbh. I think most apps would simply do nothing. Notifying the user of an event that didn't happen feels unnecessary. What do you think? Might just be a matter of returning false in those handlers to achieve this.

I updated the PR. Returning nothing or returning false in the handlers still caused the browser save dialogue to open, the current change has been tested and correctly prevents the browser save.

@JessChowdhury JessChowdhury requested review from jacobsfletch and removed request for denolfe May 21, 2024 12:06
@jacobsfletch jacobsfletch merged commit 0190eb8 into beta May 21, 2024
35 checks passed
@jacobsfletch jacobsfletch deleted the chore/beta/save-hotkey branch May 21, 2024 13:00
JessChowdhury added a commit that referenced this pull request May 21, 2024
…h no changes (#6365)

## Description

Related issue
[#214](payloadcms/payload-3.0-demo#214) (3.0).

Using the `cmd+s` hotkey in the Edit Document view was opening the
_browser_ save dialogue when no changes had been made.

This change triggers a toast info banner with `No changes to save` and
adds translated string for other languages.

PR for 3.0 is [here](#6366).

- [X] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [X] Chore (non-breaking change which does not add functionality)

## Checklist:

- [X] Existing test suite passes locally with my changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save shortcut opens save dialog if no doc changes
2 participants