Fixed toolbar not showing for seeded,untouched and then migrated RTE datatypes (#16665)

Moved 14.1 migrations into their own namespace

Co-authored-by: Sven Geusens <sge@umbraco.dk>
(cherry picked from commit d170193a95)
This commit is contained in:
Sven Geusens
2024-06-28 09:28:55 +02:00
committed by Zeegaan
parent 2fa4149b62
commit 921598b667
3 changed files with 43 additions and 2 deletions

View File

@@ -84,6 +84,9 @@ public class UmbracoPlan : MigrationPlan
// we need to re-run this migration, as it was flawed for V14 RC3 (the migration can run twice without any issues)
To<V_14_0_0.AddEditorUiToDataType>("{6FB5CA9E-C823-473B-A14C-FE760D75943C}");
To<V_14_0_0.CleanUpDataTypeConfigurations>("{827360CA-0855-42A5-8F86-A51F168CB559}");
To<V_14_0_0.MigrateRichTextConfiguration>("{FEF2DAF4-5408-4636-BB0E-B8798DF8F095}");
// To 14.1.0
To<V_14_1_0.MigrateRichTextConfiguration>("{FEF2DAF4-5408-4636-BB0E-B8798DF8F095}");
To<V_14_1_0.MigrateOldRichTextSeedConfiguration>("{A385C5DF-48DC-46B4-A742-D5BB846483BC}");
}
}

View File

@@ -0,0 +1,38 @@
using NPoco;
using Umbraco.Cms.Core;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_1_0;
public class MigrateOldRichTextSeedConfiguration : MigrationBase
{
private const string OldSeedValue =
"{\"value\":\",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|\"}";
private const string NewDefaultValue =
"{\"toolbar\":[\"styles\",\"bold\",\"italic\",\"alignleft\",\"aligncenter\",\"alignright\",\"bullist\",\"numlist\",\"outdent\",\"indent\",\"sourcecode\",\"link\",\"umbmediapicker\",\"umbembeddialog\"],\"mode\":\"Classic\",\"maxImageSize\":500}";
public MigrateOldRichTextSeedConfiguration(IMigrationContext context) : base(context)
{
}
protected override void Migrate()
{
Sql<ISqlContext> sql = Sql()
.Select<DataTypeDto>()
.From<DataTypeDto>()
.Where<DataTypeDto>(x =>
x.EditorAlias.Equals(Constants.PropertyEditors.Aliases.RichText)
&& x.Configuration == OldSeedValue);
List<DataTypeDto> dataTypeDtos = Database.Fetch<DataTypeDto>(sql);
foreach (DataTypeDto dataTypeDto in dataTypeDtos)
{
// Update the configuration
dataTypeDto.Configuration = NewDefaultValue;
Database.Update(dataTypeDto);
}
}
}

View File

@@ -4,7 +4,7 @@ using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
using Umbraco.Extensions;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_0_0;
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_1_0;
public class MigrateRichTextConfiguration : MigrationBase
{