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

fix(UVE): Ensure Window Object Re-Initialization in UVE iframe #30989

Conversation

rjvelazco
Copy link
Contributor

@rjvelazco rjvelazco commented Dec 19, 2024

This pull request includes several changes aimed at improving the functionality and testing of the EditEmaEditorComponent in the core-web library. The key updates involve refactoring the iframe URL handling, enhancing the test coverage, and improving the inline editing feature.

Refactoring and Improvements:

  • Updated the iframe src binding to use uveStore.$iframeURL() instead of $editorProps().iframe.src in edit-ema-editor.component.html.
  • Refactored the setIframeContent method to include an enableInlineEdit parameter and moved the inline editing script handling to a new method handleInlineScripts in edit-ema-editor.component.ts. [1] [2]

Testing Enhancements:

  • Added event listener and dispatcher methods to the iframe mock in edit-ema-editor.component.spec.ts to simulate iframe load events.
  • Modified multiple test cases to dispatch iframe load events and verify the iframe content in edit-ema-editor.component.spec.ts. [1] [2] [3] [4] [5]

Store and State Management:

  • Introduced a new computed property $iframeURL in the withEditor store to dynamically generate iframe URLs, including handling traditional pages by returning about:blank. [1] [2] [3] [4] [5]
  • Removed the src property from the EditorProps interface as it is now handled by the computed $iframeURL.

Code Cleanup:

  • Removed unnecessary requestAnimationFrame calls and related code from edit-ema-editor.component.ts. [1] [2]
  • Cleaned up unused imports and reorganized utility function usage in withEditor.ts.

These changes collectively enhance the maintainability, functionality, and testability of the EditEmaEditorComponent.

Video

issue-30981-uve-ensure-window-object-re-initialization-in-uve-iframe.mov

This PR fixes: #30981

@rjvelazco rjvelazco linked an issue Dec 19, 2024 that may be closed by this pull request
4 tasks
@rjvelazco rjvelazco marked this pull request as ready for review December 20, 2024 16:03
@rjvelazco rjvelazco enabled auto-merge December 20, 2024 16:31
@rjvelazco rjvelazco added this pull request to the merge queue Dec 20, 2024
Merged via the queue into main with commit a5315a4 Dec 20, 2024
22 checks passed
@rjvelazco rjvelazco deleted the issue-30981-uve-ensure-window-object-re-initialization-in-uve-iframe branch December 20, 2024 17:58
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

Successfully merging this pull request may close these issues.

UVE: Ensure Window Object Re-Initialization in UVE iframe
4 participants