feat: live preview: added outside iframe code#477
Merged
contentstackMridul merged 3 commits intolive-preview-outside-iframefrom Aug 6, 2025
Merged
feat: live preview: added outside iframe code#477contentstackMridul merged 3 commits intolive-preview-outside-iframefrom
contentstackMridul merged 3 commits intolive-preview-outside-iframefrom
Conversation
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
a3a14f6
into
live-preview-outside-iframe
10 checks passed
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.
Summary
These commits introduce comprehensive support for live preview functionality when content is opened in new tabs (instead of iframes) and significantly improve Server-Side Rendering (SSR) handling with enhanced event management.
Key Changes
Added inNewTab() utility function to detect when content is opened in a new browser tab
Modified event manager to target window.opener instead of window.parent for new tab scenarios
Updated edit button behavior to handle both iframe and new tab contexts
Implemented differentiated handling for Client-Side Rendering (CSR) vs Server-Side Rendering (SSR)
Added automatic page reload for SSR websites when entry content changes
Introduced event type metadata to distinguish between different update scenarios
Added new event types: HASH_CHANGE and URL_CHANGE for granular control
Implemented proper URL parameter updates using history.pushState() for hash changes
Added robust error handling with logging for post message events
Enhanced type definitions for live preview event data
Fixed URL change handling logic with proper null checking
Removed debug console statements from production code
Improved error boundaries around window operations
Test Results
