Skip to content

chore(style-editor): Created API to define style editor form structure on dotcms/uve#34038

Merged
KevinDavilaDotCMS merged 15 commits intomainfrom
33809-task-createapi-to-define-style-editor-form-structure-on-dotcmsuve
Dec 11, 2025
Merged

chore(style-editor): Created API to define style editor form structure on dotcms/uve#34038
KevinDavilaDotCMS merged 15 commits intomainfrom
33809-task-createapi-to-define-style-editor-form-structure-on-dotcmsuve

Conversation

@KevinDavilaDotCMS
Copy link
Contributor

@KevinDavilaDotCMS KevinDavilaDotCMS commented Dec 8, 2025

2025-12-10.13-02-36.mov

Usage

  // First define the form with the API.
    const blogForm = defineStyleEditorSchema({
        contentType: 'Content',
        sections: [
            {
                title: 'Typography',
                fields: [
                    styleEditorField.checkboxGroup({
                        label: 'New CheckboxGroup',
                        options: [
                            {
                                label: 'Option 1',
                                value: 'option1'
                            },
                            {
                                label: 'Option 2',
                                value: 'option2'
                            }
                        ],
                        defaultValue: {
                            option1: false,
                            option2: false
                        },
                    }),
                    styleEditorField.radio({
                        label: 'Layout',
                        columns: 2,
                        options: [
                            {
                                label: 'Option 1',
                                value: 'option1',
                                imageURL: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSphn5CRr3MrQUjWWH7ByHWW-lROnVQl4XxYQ&s',
                                width: 119
                            },
                            {
                                label: 'Option 2',
                                value: 'option2',
                                imageURL: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSphn5CRr3MrQUjWWH7ByHWW-lROnVQl4XxYQ&s'
                            },
                            {
                                label: 'New Option',
                                value: ''
                            },
                            {
                                label: 'New Option',
                                value: 'new-option'
                            }
                        ],
                    })
                ]
            }
        ]
    })
    
    // Then use the helper hook.

    useStyleEditorSchemas([blogForm])
    // This hook internally use a exposed function called registerStyleEditorSchemas()
    // In Angular, we can use this function directly. We can create a service for this too, but maybe is a lot of code only for that, but we can recheck this later 

This PR fixes: #33809

…ng input handling

- Added export for  in  to define valid input types.
- Updated  function in  to ensure type safety for  and .
- Introduced comprehensive unit tests in  to validate the behavior of various field types, including input, dropdown, and radio fields.
- Enhanced documentation in  to clarify usage and experimental status of style editor functions.
@KevinDavilaDotCMS KevinDavilaDotCMS linked an issue Dec 8, 2025 that may be closed by this pull request
8 tasks
- Renamed  to  and  to  for better context.
- Updated type references in  and  to use the new type names, enhancing type safety in the style editor functionality.
…ctionality

- Introduced the  hook to register style editor forms with the UVE editor.
- Added comprehensive unit tests for the hook to validate its behavior with various form schemas.
- Updated the public API to include a new action for registering style schemas in the editor.
- Enhanced the style editor's public interface to support the new functionality.
- Updated the normalization process for field and section definitions to ensure all type-specific properties are encapsulated within a  object, promoting consistency in the schema format sent to UVE.
- Enhanced type safety for input fields by introducing a new  type, ensuring that  types align with .
- Improved documentation to clarify the normalization process and the structure of the resulting schemas.
- Adjusted the public API to reflect these changes, ensuring a seamless integration for developers using the style editor.
…t options

- Added handling for radio-specific properties in the normalization process, allowing for dynamic column configurations.
- Updated the structure of normalized fields to simplify the schema format.
- Improved test cases for style editor forms to reflect changes in field definitions and layout options.
- Enhanced documentation to clarify the usage of columns in radio fields and their impact on layout.
- Updated the  function to  for improved clarity and consistency in naming.
- Adjusted all references in tests and documentation to reflect the new function name.
- Ensured that the public API remains consistent with the updated naming convention, enhancing developer experience.
- Introduced new interfaces for option objects, including  and , to standardize option structures across dropdowns, radio buttons, and checkboxes.
- Updated existing field interfaces to utilize these new types, enhancing type safety and clarity in option handling.
- Added a new  interface to encapsulate field-specific properties, streamlining the configuration process for various field types.
- Improved documentation to clarify the usage and structure of the new option types and field schema configuration.
…port

- Introduced a new type, StyleEditorCheckboxDefaultValue, to standardize the default value structure for checkbox groups.
- Updated existing interfaces to utilize the new type, improving type safety and clarity in checkbox handling.
- Enhanced documentation to provide examples and clarify the usage of the new checkbox default value type.
- Added tests to ensure the useStyleEditorSchemas hook does not cause infinite loops when inline objects are passed on each render.
- Demonstrated the importance of stable references to prevent unnecessary re-registrations during re-renders.
- Updated existing test cases to validate the expected behavior of the hook under various rendering scenarios.
- Updated the style schema interface to use StyleEditorFormSchema for improved type safety.
- Modified the handling of style schemas in the EditEmaEditorComponent to align with the new structure.
- Enhanced the display of style schemas in the dot-uve-palette component for better usability.
- Adjusted related tests to reflect changes in schema structure and ensure correct functionality.
@KevinDavilaDotCMS KevinDavilaDotCMS added this pull request to the merge queue Dec 11, 2025
Merged via the queue into main with commit 7c878a6 Dec 11, 2025
26 checks passed
@KevinDavilaDotCMS KevinDavilaDotCMS deleted the 33809-task-createapi-to-define-style-editor-form-structure-on-dotcmsuve branch December 11, 2025 18:09
@KevinDavilaDotCMS KevinDavilaDotCMS linked an issue Dec 11, 2025 that may be closed by this pull request
6 tasks
dsolistorres pushed a commit that referenced this pull request Feb 20, 2026
…e on dotcms/uve (#34038)

https://github.com/user-attachments/assets/67c0f657-49e9-4e5f-9071-2bc830cbea2a



### Usage


```
  // First define the form with the API.
    const blogForm = defineStyleEditorSchema({
        contentType: 'Content',
        sections: [
            {
                title: 'Typography',
                fields: [
                    styleEditorField.checkboxGroup({
                        label: 'New CheckboxGroup',
                        options: [
                            {
                                label: 'Option 1',
                                value: 'option1'
                            },
                            {
                                label: 'Option 2',
                                value: 'option2'
                            }
                        ],
                        defaultValue: {
                            option1: false,
                            option2: false
                        },
                    }),
                    styleEditorField.radio({
                        label: 'Layout',
                        columns: 2,
                        options: [
                            {
                                label: 'Option 1',
                                value: 'option1',
                                imageURL: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSphn5CRr3MrQUjWWH7ByHWW-lROnVQl4XxYQ&s',
                                width: 119
                            },
                            {
                                label: 'Option 2',
                                value: 'option2',
                                imageURL: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSphn5CRr3MrQUjWWH7ByHWW-lROnVQl4XxYQ&s'
                            },
                            {
                                label: 'New Option',
                                value: ''
                            },
                            {
                                label: 'New Option',
                                value: 'new-option'
                            }
                        ],
                    })
                ]
            }
        ]
    })
    
    // Then use the helper hook.

    useStyleEditorSchemas([blogForm])
    // This hook internally use a exposed function called registerStyleEditorSchemas()
    // In Angular, we can use this function directly. We can create a service for this too, but maybe is a lot of code only for that, but we can recheck this later 
```

---------

Co-authored-by: Kevin <kfariid@gmail.com>
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.

[TASK] Implement Style Editor API for Headless Form Registration in UVE

6 participants