-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(UVE): Ensure Window Object Re-Initialization in UVE iframe (#30989)
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]](diffhunk://#diff-24dc496db1eb6feb3e10a031baa4b4b63c20f1cd02ade574065f6b967f11c365L195-L215) [[2]](diffhunk://#diff-24dc496db1eb6feb3e10a031baa4b4b63c20f1cd02ade574065f6b967f11c365L685-R718) ### 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]](diffhunk://#diff-34ddc5fbacaf04b962f2037385ed284310d5faf35ba409d5705b2caadd5d796aL2617-R2625) [[2]](diffhunk://#diff-34ddc5fbacaf04b962f2037385ed284310d5faf35ba409d5705b2caadd5d796aR2650-R2652) [[3]](diffhunk://#diff-34ddc5fbacaf04b962f2037385ed284310d5faf35ba409d5705b2caadd5d796aL2668-R2686) [[4]](diffhunk://#diff-34ddc5fbacaf04b962f2037385ed284310d5faf35ba409d5705b2caadd5d796aR2826-R2842) [[5]](diffhunk://#diff-34ddc5fbacaf04b962f2037385ed284310d5faf35ba409d5705b2caadd5d796aR2858-R2860) ### 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]](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0L39-R61) [[2]](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0L124-L127) [[3]](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0L140-L141) [[4]](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0L150) [[5]](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0R193-R203) * 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]](diffhunk://#diff-24dc496db1eb6feb3e10a031baa4b4b63c20f1cd02ade574065f6b967f11c365L195-L215) [[2]](diffhunk://#diff-24dc496db1eb6feb3e10a031baa4b4b63c20f1cd02ade574065f6b967f11c365L685-R718) * 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 https://github.com/user-attachments/assets/2d020e92-0dd3-4b80-8bb4-028c5a8b252a
- Loading branch information
Showing
7 changed files
with
119 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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