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

Don’t ask “Save draft?” unless the text has been edited #2

Open
roryokane opened this issue Apr 5, 2019 · 0 comments
Open

Don’t ask “Save draft?” unless the text has been edited #2

roryokane opened this issue Apr 5, 2019 · 0 comments

Comments

@roryokane
Copy link

roryokane commented Apr 5, 2019

When I open a draft by double-clicking it, then change my mind and hit Back without typing any text, I am still prompted with this alert:

Save draft?
[Discard] [Save]

This alert should only be shown if the text at the moment I hit Back is different from the text as it was when I first opened the draft.

For the Discard feature to work, you must already be saving the original text when I first open the draft. So this feature should only need one extra if, plus a call to your discard function in the alternative branch. In pseudo-code:

if (textField.currentValue.equals(draftModel.originalValue)) {
    discard();
} else {
    // show prompt and save or discard as you currently do
}
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

No branches or pull requests

1 participant