core icon indicating copy to clipboard operation
core copied to clipboard

feat(edit-content): Introduce Native Components for CustomField

Open nicobytes opened this issue 4 months ago • 2 comments

Proposed Changes

This pull request introduces significant improvements to the custom field infrastructure in the DotCMS content editor, focusing on extensibility, UI flexibility, and developer ergonomics. The main changes include the addition of a new IframeFieldComponent for rendering custom fields, enhancements to the form bridge API for both Angular and Dojo frameworks, and schema updates to support rendered values.

Key changes:

Custom Field Rendering and UI Enhancements

  • Added a new IframeFieldComponent (iframe-field.components.ts, iframe-field.component.html, iframe-field.component.scss) that renders custom fields using an iframe, supporting both inline and modal display modes, and provides robust communication with the parent form via a form bridge. This enables more flexible and interactive custom field experiences. [1] [2] [3]
  • Implemented logic to handle fullscreen toggling, dynamic resizing, and secure message passing between the parent and the custom field iframe.

Form Bridge API Improvements

  • Introduced the FormFieldAPI interface, providing a standardized way to interact with individual form fields (get/set value, onChange, enable/disable, show/hide) across both Angular and Dojo form bridges. This includes new getField methods in both AngularFormBridge and DojoFormBridge. [1] [2] [3] [4]
  • Updated imports and type definitions to support the new API. [1] [2]

Schema and Service Updates

  • Added an optional rendered property to DotCMSContentTypeField and ContentTypeCustomField interfaces, allowing fields to store rendered values for enhanced display or processing. [1] [2]
  • Introduced the getContentTypeWithRender method in DotContentTypeService to fetch content types with render mode enabled, supporting richer field rendering scenarios.

These changes collectively modernize the way custom fields are rendered and interacted with in the DotCMS content editor, paving the way for more dynamic and user-friendly field experiences.


References:

  • Iframe custom field rendering and UI: [1] [2] [3]
  • Form bridge API and interface improvements: [1] [2] [3] [4] [5] [6]
  • Schema/service enhancements: [1] [2] [3]

Checklist

  • [x] Tests
  • [x] Translations
  • [x] Security Implications Contemplated (add notes if applicable)

This PR fixes: #32915

nicobytes avatar Sep 04 '25 16:09 nicobytes

Legal Risk

The following dependencies were released under a license that has been flagged by your organization for consideration.

Recommendation

While 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.

MPL-2.0

Legal Risk

The following dependencies were released under a license that has been flagged by your organization for consideration.

Recommendation

While 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.

MPL-2.0