Skip to content

Conversation

@lauraneto
Copy link
Contributor

@lauraneto lauraneto commented Jun 11, 2025

For BlockList and BlockGrid there are notification handlers that handle replacing the keys of blocks with new ones on copy of scaffolding. This was missing for the RTE blocks.
I did a few tests and couldn't see an issue with just re-using the same logic as for BlockList or BlockGrid, but let me know if there are any extra considerations that we should take in mind.

Testing

  1. Create an element document type.
  2. Create an RTE data type and configure it so blocks can be added, and add the element created in the previous step.
  3. Create a document type, allowed at root, and add a property using the data type created in the previous step.
  4. Create and publish a new page using the created document type and insert some content in the RTE with at least one block.
  5. Check the keys of the blocks in the new page by either:
  • Checking the response of the management API while requesting the document
    image
  • Checking the value of the property in the umbracoPropertyData database table
  1. Make a copy of the page and check that the keys are different from the original.
  2. Make a blueprint from the created page and create a new page using that blueprint. Check that the keys of the new page are different from the original.

This was already present for BlockList and BlockGrid, but not Blocks in RTE.
@lauraneto lauraneto marked this pull request as ready for review June 11, 2025 12:48
Copilot AI review requested due to automatic review settings June 11, 2025 12:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for replacing block keys in Rich Text Editor (RTE) blocks during clone and scaffold operations by reusing the existing block editor notification logic.

  • Introduces RichTextPropertyNotificationHandler to handle RTE block key replacement
  • Registers the new handler for save, copy, and scaffold notifications

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
RichTextPropertyNotificationHandler.cs Implements a notification handler for RTE block keys
UmbracoBuilder.CoreServices.cs Registers the new handler in the core notification setup
Comments suppressed due to low confidence (2)

src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs:355

  • There are no existing tests verifying that RTE block keys are replaced on copy/scaffold operations—adding unit or integration tests would help prevent regressions.
.AddNotificationHandler<ContentSavingNotification, RichTextPropertyNotificationHandler>()

src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyNotificationHandler.cs:20

  • The Constants identifier is in the Umbraco.Cms.Core namespace but there's no using Umbraco.Cms.Core;—add the directive or fully qualify the reference.
protected override string EditorAlias => Constants.PropertyEditors.Aliases.RichText;

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this out and it works as expected with the copy and blueprint operations.

@AndyButland AndyButland merged commit 9a96ebf into main Jun 12, 2025
24 of 25 checks passed
@AndyButland AndyButland deleted the v16/bugfix/regenerate-ids-for-rte-blocks branch June 12, 2025 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants