34420 unify component#36172
Conversation
…rapper - Added a new `DotLegacyImageEditorLauncherService` to manage the image editor dialog lifecycle. - Introduced `DotLegacyImageEditorDialogComponent` for rendering the image editor iframe. - Updated `DotBinaryFieldWrapperComponent` to utilize the image editor service and handle value updates. - Enhanced the binary field HTML template to include an image editor toggle. - Added unit tests for the new image editor dialog and launcher service. This implementation allows users to edit images directly within the binary field, improving the content editing experience.
…message event handling - Added `dispatchSpy.restore()` calls to ensure proper cleanup after each test case. - Updated the origin check in the message event test to use a variable for invalid origins, improving test reliability. - Enhanced assertions to ensure that only valid events trigger the expected behavior. These changes improve the robustness of the unit tests for the `DotLegacyImageEditorLauncherService`.
- Introduced a new specification for the binary field image editor, verifying the visibility of the Edit button and the opening of the legacy Dojo Image Editor in both new and legacy content editors. - Created helper classes for managing interactions with the binary field and legacy binary field within the tests. - Updated the binary field helper to include methods for image upload and editor interaction. - Enhanced the legacy binary field helper to support image editing in the legacy editor. These changes improve the testing coverage for the binary field image editor functionality, ensuring a seamless user experience across different content editor versions.
…ar' of github.com:dotCMS/core into 34420-epic-image-editor-feature-parity-migrate-to-angular
…ame security handling - Changed the default image URL for import-from-URL tests to a stable 800x800 PNG from `placehold.co`. - Updated the `DotLegacyImageEditorDialogComponent` to use the SafeUrlPipe for iframe URL sanitization, improving security. - Adjusted related documentation to reflect the new image URL and its dimensions. These changes enhance the reliability and security of the binary field image editor functionality.
…file - Deleted the `binary-field-image-editor.md` specification file as it is no longer needed. - This cleanup helps streamline the project documentation and maintain focus on current testing strategies. No functional changes were made to the codebase.
- Replaced the `DotEditContentBinaryFieldComponent` with `DotEditContentFileFieldComponent` to unify the handling of binary and file fields. - Updated related tests and helper classes to reflect the new component structure. - Removed outdated binary field HTML, SCSS, and spec files to streamline the codebase. These changes enhance the maintainability and consistency of the binary field functionality within the content editing framework.
- Introduced `LegacyDialogImageEditorLauncher` to replace the previous Dojo-based image editor integration, allowing the legacy image editor to be opened in a PrimeNG dialog. - Updated the `DotFileFieldComponent` to conditionally expose the image editor action only for binary fields. - Modified related tests and components to accommodate the new image editor launcher and ensure proper functionality. - Enhanced the styling of the file field component for better layout consistency. These changes improve the user experience by modernizing the image editing workflow within the content editing framework.
|
Claude finished @nicobytes's task in 1m 23s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackAll 82 changed files are frontend-only (Angular/TypeScript in Categories checked and cleared:
Summary: This PR is a pure frontend refactor — it removes the legacy Label |
🤖 Codex Review —
|
- Updated the binary field image editor tests to reflect the new legacy image editor dialog behavior. - Added tests to verify that the "Edit image" button is hidden for non-image file uploads and that the confirmation popup appears when removing a file. - Improved the existing test for editing binary content to ensure it displays the preview without server errors. These changes enhance the test coverage and reliability of the binary field image handling functionality within the content editing framework.
…nd image fields - Refactored the required field tests for binary, file, and image fields to use a consistent structure with `beforeEach` and `afterEach` hooks for setup and teardown. - Improved test readability and maintainability by encapsulating the creation and deletion of content types within dedicated hooks. - Ensured that error handling for required fields is properly tested across all relevant field types. These changes enhance the clarity and organization of the end-to-end tests for required fields in the content editing framework.
🤖 Bedrock Review —
|
|
@copilot resolve the merge conflicts in this pull request |
Legal RiskThe following dependencies were released under a license that RecommendationWhile merging is not directly blocked, it's best to pause and consider what it means to use this license before continuing. If you are unsure, reach out to your security team or Semgrep admin to address this issue. GPL-2.0 MPL-2.0
|
Updated the hover action for the AI button to force it, ensuring it behaves correctly when disabled. Additionally, improved the visibility checks for the legacy image editor iframe, increasing the timeout for better reliability during tests.
There was a problem hiding this comment.
Pull request overview
This pull request unifies Binary field handling under the dot-edit-content-file-field / dot-file-field implementation, adds legacy image-editor launchers to support both the new Angular editor and the legacy JSP editor bridge, and updates unit/E2E tests and selectors accordingly.
Changes:
- Replace the legacy
dot-edit-content-binary-fieldimplementation with the unified file-field component stack, including a custom-element bridge for legacy JSP usage. - Add legacy image-editor launcher services (Dojo DOM-event and dialog-iframe variants) plus store support for image-editor round-trips and editable-as-text hydration.
- Refactor and expand Playwright E2E helpers/tests for File/Image/Binary fields, including new remove-confirmation flows and editor-opening assertions.
Reviewed changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| dotCMS/src/main/webapp/WEB-INF/messages/Language.properties | Adds new i18n keys used by the updated file preview UI (confirm remove, download/info tooltips). |
| core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-contentlet-quick-edit/dot-uve-quick-edit-form/dot-uve-quick-edit-form.component.ts | Removes legacy binary field component imports in EMA quick edit. |
| core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-contentlet-quick-edit/dot-uve-quick-edit-form/dot-uve-quick-edit-form.component.spec.ts | Updates testbed overrides/mocks after binary→file-field unification. |
| core-web/libs/portlets/edit-ema/portlet/src/lib/edit-ema-editor/components/dot-uve-contentlet-quick-edit/dot-uve-quick-edit-form/dot-uve-quick-edit-form.component.html | Renders binary/image/file fields via dot-file-field with image editor disabled for EMA quick edit. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/store/file-field.store.ts | Extends store for upload-type routing, editable-as-text hydration, image-editor temp application, and contentlet-based preview hydration. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/legacy-dojo-image-editor-launcher.service.ts | Adds Dojo-event-based launcher for legacy JSP editor integration. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/legacy-dialog-image-editor-launcher.service.ts | Adds PrimeNG-dialog + postMessage-based launcher for the legacy JSP editor in the new Angular UI. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/index.ts | Barrel exports for the new image-editor launcher services/components/models. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/image-editor-launcher.service.spec.ts | Adds unit tests for the two launcher implementations. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/image-editor-launcher.model.ts | Introduces the launcher interface + open-params contract. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/services/image-editor/dot-legacy-image-editor-dialog.component.ts | Adds dialog iframe component for embedding image-editor-standalone.jsp. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.stories.ts | Removes Storybook stories for the file-field wrapper. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.ts | Adds valueUpdated output to bubble inner field changes to parents (FileAsset autofill). |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.html | Forwards valueUpdated from inner dot-file-field. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field/dot-file-field.component.ts | Adds image-editor availability rules, legacy launcher routing, contentlet hydration for binary, and valueUpdated emission logic. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field/dot-file-field.component.spec.ts | Updates providers to include the new launcher services. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field/dot-file-field.component.scss | Removes unused drop-zone active styling block. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field/dot-file-field.component.html | Wires preview component edit-image action + adds preview test id. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts | Adds remove confirmation popup plumbing, edit-image output, and content propagation for editable-as-text. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.spec.ts | Updates component providers and stabilizes dialog interaction assertions. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.scss | Simplifies styles and aligns with new layout structure. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.html | Refactors preview markup, adds tooltips, adds confirm popup, and introduces edit-image/remove flows. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-binary-field-ce-bridge/dot-binary-field-ce-bridge.component.ts | Adds a custom-element bridge for the legacy dotcms-binary-field contract. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/utils/mock.ts | Removes legacy binary-field mocks. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/utils/binary-field-utils.ts | Removes legacy binary-field utils. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/store/binary-field.store.ts | Removes legacy binary-field store implementation. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/store/binary-field.store.spec.ts | Removes legacy binary-field store tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/service/dot-binary-field-validator/dot-binary-field-validator.service.ts | Removes legacy binary-field validator service. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/service/dot-binary-field-validator/dot-binary-field-validator.service.spec.ts | Removes legacy binary-field validator tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/service/dot-binary-field-edit-image/dot-binary-field-edit-image.service.ts | Removes legacy binary-field edit-image service. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/service/dot-binary-field-edit-image/dot-binary-field-edit-image.service.spec.ts | Removes legacy binary-field edit-image service tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/interfaces/index.ts | Removes legacy binary-field interfaces/types. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/dot-edit-content-binary-field.component.ts | Removes the legacy binary-field Angular component. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/dot-edit-content-binary-field.component.stories.ts | Removes legacy binary-field Storybook stories. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/dot-edit-content-binary-field.component.scss | Removes legacy binary-field styles. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/dot-edit-content-binary-field.component.html | Removes legacy binary-field template. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-wrapper/dot-binary-field-wrapper.component.ts | Removes the legacy wrapper that enabled the old image editor wiring. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-wrapper/dot-binary-field-wrapper.component.html | Removes legacy wrapper template. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/store/dot-binary-field-url-mode.store.ts | Removes legacy “import by URL” store for the old binary field. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/store/dot-binary-field-url-mode.spec.ts | Removes legacy URL-mode store tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/dot-binary-field-url-mode.component.ts | Removes legacy URL-mode component. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/dot-binary-field-url-mode.component.spec.ts | Removes legacy URL-mode component tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/dot-binary-field-url-mode.component.scss | Removes legacy URL-mode styles. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-url-mode/dot-binary-field-url-mode.component.html | Removes legacy URL-mode template. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-ui-message/dot-binary-field-ui-message.component.ts | Removes legacy UI-message component. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-ui-message/dot-binary-field-ui-message.component.spec.ts | Removes legacy UI-message component tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-ui-message/dot-binary-field-ui-message.component.scss | Removes legacy UI-message styles. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-ui-message/dot-binary-field-ui-message.component.html | Removes legacy UI-message template. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-preview/dot-binary-field-preview.component.ts | Removes legacy preview component. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-preview/dot-binary-field-preview.component.stories.ts | Removes legacy preview stories. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-preview/dot-binary-field-preview.component.scss | Removes legacy preview styles. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-preview/dot-binary-field-preview.component.html | Removes legacy preview template. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-editor/dot-binary-field-editor.component.ts | Removes legacy “create/edit file” editor component. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-editor/dot-binary-field-editor.component.spec.ts | Removes legacy editor component tests. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-editor/dot-binary-field-editor.component.scss | Removes legacy editor styles. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/components/dot-binary-field-editor/dot-binary-field-editor.component.html | Removes legacy editor template. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.ts | Switches binary fields to render via dot-edit-content-file-field. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.spec.ts | Updates binary-field component mapping/provider setup in tests. |
| core-web/libs/edit-content/src/lib/components/dot-edit-content-field/dot-edit-content-field.component.html | Renders binary fields using dot-edit-content-file-field and forwards valueUpdated consistently. |
| core-web/libs/edit-content/src/index.ts | Updates public exports to expose the new CE bridge instead of the removed binary component. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/image-field/image-field.spec.ts | Adds assertion that image-field uploads do not show the “Edit image” action and refactors required-field coverage. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/file-field/helpers/file-field.ts | Extends E2E helper for preview/edit/remove/confirm flows. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/file-field/file-field.spec.ts | Adds E2E assertion that file-field does not show “Edit image” and refactors required-field coverage. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/binary-field/helpers/legacy-binary-field.ts | Updates legacy editor locators/selectors to match unified field/test ids. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/binary-field/helpers/binary-field.ts | Refactors Binary field helper to extend the unified FileField helper and updates image-editor expectations. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/binary-field/binary-field.spec.ts | Adds new E2E cases for remove confirmation, hydration, and edit-button visibility rules. |
| core-web/apps/dotcms-ui-e2e/src/tests/edit-content/fields/binary-field/binary-field-image-editor.spec.ts | Clarifies and validates the new-editor image-editor launch path (dialog iframe). |
| core-web/apps/dotcms-binary-field-builder/src/app/app.module.ts | Updates the binary-field builder app to register the new CE bridge component. |
…e binary field component Renamed the method for asserting the disabled state of the AI button to `expectAiButtonDisabledWithTooltipWhenApplicable` for clarity. Improved the tooltip assertion logic to handle cases where the button is enabled. Additionally, updated the binary field component to include the `fieldVariable` in the file info structure, ensuring accurate metadata handling. Enhanced the dot-file-field-preview component to utilize the new field variable for resource link fetching.
…4420-unify-component
Manual QA — Unified File/Binary/Image fieldsPR: #36172 · Fixes: #34420
Build: branch Setup
Create 4 Content Types for Binary (2 editors × optional/required) + File + Image:
Test data
Expected copy
🔴 Critical (run first)Binary field — new editor (CE2)
Binary field — old editor (legacy / CE1)
File field
|
| Manual ID | Editor | Playwright spec |
|---|---|---|
| TC-BIN-001…007 | CE2 | binary-field.spec.ts |
| TC-BIN-008 | CE2 | binary-field-image-editor.spec.ts (new editor) |
| TC-BIN-009 / TC-BIN-*-L | Legacy | binary-field-image-editor.spec.ts (legacy editor) |
| TC-FILE-001…005 | CE2 | file-field.spec.ts |
| TC-IMG-001…004 | CE2 | image-field.spec.ts |
Bug report template
Please include: TC-ID, editor (CE2 / Legacy), Content Type + field variable, steps, expected vs actual, screenshot, browser, instance URL/version.
Tester: _______________ · Date: _______________ · Result: ☐ Pass all critical · ☐ Failures (list TC-IDs + editor)
Updated ESLint configuration for Playwright to enforce stricter rules, including disabling force clicks and requiring visibility checks. Refactored test code to remove forced clicks and added helper methods for better readability. Improved the handling of dropdown interactions and API link clicks in tests, ensuring more reliable UI interactions. Additionally, optimized relationship field tests by introducing new methods for asserting row constraints and selections, enhancing overall test clarity and maintainability.
…4420-unify-component
This pull request introduces significant updates to the handling and testing of binary fields (file/image uploads) in the content editing experience. The main focus is on unifying the binary field implementation under the new
dot-edit-content-file-fieldcomponent, updating related imports and tests, and improving Playwright E2E test coverage for both the new and legacy editors. The changes also include new and refactored E2E test helpers for binary fields, and adjustments to test data and selectors.Component and Module Refactoring:
dot-edit-content-file-fieldcomponent, replacing the previousdot-edit-content-binary-fieldand its wrapper throughout the app and tests. This includes updating Angular module imports, dependency injection, and testbed configuration to use the new component and its bridge (DotBinaryFieldCeBridgeComponent). [1] [2] [3] [4] [5] [6] [7] [8]E2E Test Enhancements:
Test Helper Improvements:
Test Data and Selector Updates:
These changes collectively modernize the binary field experience, improve test coverage and reliability, and streamline the codebase for future enhancements.
This PR fixes: #34420