-
Notifications
You must be signed in to change notification settings - Fork 77
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
Implement warning for unsaved changes in dashboard #145
Comments
Sounds fine to me, I would accept a PR, thanks. I haven't thought much about this, not sure how the warning should be designed (I feel DOM-based would be better). |
nothing can be done... ? https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload#Notes |
The dashboard code is the one swapping panes, so it's just a matter of having a warning when a pane is detected as having unsaved changes, and waiting for confirmation before swapping. If the only case left is the closing of the whole dashboard itself, it's not too bad. |
The warning for dashboard closing will always be a |
I have some problem with // Cleanup
var onBeforeUnload = function() {
var entry;
while ( (entry = listenerEntries.pop()) ) {
entry.dispose();
}
window.removeEventListener('beforeunload', onBeforeUnload);
};
window.addEventListener('beforeunload', onBeforeUnload); |
I'll close this in favor of the PR, where we can review the changes easily. |
I want to help fixing gorhill/uBlock#3271
Since the dashboard is driven by
iframes
, I think one way to implement it is to make eachiframe
to expose a global variable,hasUnsavedChanges
. When the dashboard is closing or the tab is changing, the main frame will check the global variable of the child frame and show a warning message if needed.@gorhill Do you think this is a good way to implement it? Do you want me to PR?
The text was updated successfully, but these errors were encountered: