Jump to field on click#54
Open
muzzwood wants to merge 3 commits into
Open
Conversation
The banner is now appended to document.body as a fixed element (top: 0), sitting entirely outside the ExtJS layout. CSS :has() selectors push the MODX layout panels below it; relayoutModx() overrides getViewSize() on the ExtJS Viewport to subtract the banner height so inner panel bodies are not clipped. The race condition in the setTimeout cleanup path is also fixed: recompute fresh DOM state inside the callback and add the missing else-if branch to restore getViewSize when both panel and banner are gone.
Clicking a data-magicpreview-field element in the preview iframe sends a postMessage to the manager. The manager scrolls the resource form to the matching ContentBlocks field (data-field attribute), activates its tab if needed, focuses the element, and briefly highlights it with a blue outline that fades via CSS transition. Window mode is supported via a relay listener in preview.tpl that forwards messages from the frontend iframe to the manager via window.opener.
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.
When an element is clicked on in the preview, if it's the output of a ContentBlocks field, the resource edit form in the manager will automatically scroll to it. And switch tabs if not on the right one.
Currently this only applies to ContentBlocks fields, I can't get it to reliably work with core resource fields yet.
Scrolling caused some issues when the draft panel was visible so the draft panel has been moved to above the ExtJS layout which gets recalculated to prevent some overflow at the bottom of the form being hidden.
This functionality requires some data attributes to be injected into ContentBlocks output via a new event within the preview. So it'll only work with an upcoming CB release.