Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V16: Migrate TinyMCE data type configuration to Tiptap #18843

Merged
merged 11 commits into from
Apr 3, 2025

Conversation

Zeegaan
Copy link
Member

@Zeegaan Zeegaan commented Mar 27, 2025

Description

Migrates the data type configuration of TinyMCE rich-text editors over to Tiptap.

How to test?

  • on v16/dev, create a TinyMCE rich-text editor datatype, (more with different configurations would be ideal)
  • Switch to this branch
  • Run the site, it should redirect you to /umbraco/upgrade, run the migration
  • Assert that your rich-text editor has been migrated to Tiptap, and has the same configuration (mainly toolbar)
  • We should also test that we can disable this migration, if we do not want to migrate (for example, if you have the TinyMCE package installed)
  • Do the same as above, but instead before running the migration, create a new class in your Web.UI project, and paste in the following code:
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;

namespace Umbraco.Cms.Web.UI;

public class MyConfigureOptions : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.Services.Configure<TinyMceToTiptapMigrationSettings>(settings =>
        {
            settings.DisableMigration = true;
        });
    }
}
  • Assert that your RTE did NOT get migrated over to Tiptap 😁

@Zeegaan Zeegaan marked this pull request as ready for review March 27, 2025 19:28
@Copilot Copilot bot review requested due to automatic review settings March 27, 2025 19:28
Copy link
Contributor

@Copilot 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

This PR migrates the TinyMCE rich text editor configuration to TipTap and introduces an option to disable the migration. Key changes include:

  • Adding MigrateRichtextEditorToTiptap to transform toolbar settings and update the editor alias.
  • Updating the upgrade plan to include the new migration step.
  • Registering and defining the TipTapMigrationSettings model for conditional migration.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
MigrateRichtextEditorToTiptap.cs Implements migration logic from TinyMCE to TipTap with toolbar item mapping
UmbracoPlan.cs Schedules the new migration in the upgrade plan with a unique GUID
UmbracoBuilder.Configuration.cs Registers TipTapMigrationSettings via dependency injection
TipTapMigrationSettings.cs Adds a configuration model to optionally disable the migration
Comments suppressed due to low confidence (2)

src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_0_0/MigrateRichtextEditorToTiptap.cs:42

  • [nitpick] Consider renaming 'toolBarList' to 'toolbarList' for consistency with common naming conventions in the codebase.
if (!dataType.ConfigurationData.TryGetValue("toolbar", out var toolbar) || toolbar is not List<string> toolBarList)

src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_0_0/MigrateRichtextEditorToTiptap.cs:51

  • Consider adding unit tests for the MapToolbarItem method to ensure all toolbar items are correctly mapped during the migration.
private string? MapToolbarItem(string item)

Zeegaan and others added 3 commits April 3, 2025 09:17
…ptap

# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
if we can't map to a known Tiptap toolbar extension (manifest alias),
then it may cause an issue with the toolbar rendering.
@leekelleher leekelleher changed the title V16: Migrate tiny to tiptap V16: Migrate TinyMCE data type configuration to Tiptap Apr 3, 2025
Copy link
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

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

@Zeegaan Tested out with the various scenarios, all looking good! 🚀 🙌

To note, I have renamed the migration and settings class to include a reference to TinyMCE. From a 3rd-party perspective, it helps to clarify the intention of the migration/disabling config.
I hope this is okay, apologies for not discussing with you beforehand.

I also set the default result of the switch to return null, as if a TinyMCE toolbar alias doesn't map to one of our known Tiptap toolbar extensions, then it may cause an issue with rendering the toolbar.

@leekelleher leekelleher enabled auto-merge (squash) April 3, 2025 18:33
@leekelleher leekelleher merged commit e0341f9 into v16/dev Apr 3, 2025
24 of 25 checks passed
@leekelleher leekelleher deleted the v16/feature/migrate-tiny-to-tiptap branch April 3, 2025 18:52
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