feat(manager): warn when closing or leaving with unsaved changes (Resources, Elements, Files) - #78
Open
Ibochkarev wants to merge 2 commits into
Open
feat(manager): warn when closing or leaving with unsaved changes (Resources, Elements, Files)#78Ibochkarev wants to merge 2 commits into
Ibochkarev wants to merge 2 commits into
Conversation
…ources, Elements, Files) - Use isDirty() for beforeunload in MODx.FormPanel onReady so any form change triggers the warning without requiring field blur; remove duplicate handler from resource panel. - On left sidebar tab switch (Resources/Elements/Files), confirm when content has a dirty form; add hasDirtyContentForm() on layout. - On Cancel button (toolbar redirect), confirm when form panel is dirty so Elements and Files match Resource behavior. Resolves modxcms#16277
Bypass left-tab confirmation after Yes, bind a single beforeunload via hasDirtyContentForm, and suppress the native prompt for MODx.loadPage so Cancel no longer double-prompts (modxcms#16277).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что сделано
Предупреждения о несохранённых изменениях работают одинаково для Resources, Elements и Files, когда
confirm_navigationвкл:beforeunloadчерезMODx.bindUnsavedBeforeUnload(), проверкаhasDirtyContentForm()(любая content-форма dirty; blur поля не требуется).MODx.loadPageставитsuppressUnsavedWarning, чтобы браузер не спрашивал снова.Resource-only
warnUnsavedChangesbeforeunload handler убран.Зачем нужно
Закрытие или уход с dirty-ресурсом было неконсистентно, а Elements/Files не предупреждали так же (modxcms#16277). Это теряет работу и вредит доступности.
Как проверить
Связанные
Refs modxcms#16277
Оригинал: modxcms#16848