Skip to content

Commit 921598b

Browse files
MigaroezZeegaan
authored andcommitted
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 <[email protected]> (cherry picked from commit d170193)
1 parent 2fa4149 commit 921598b

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ protected virtual void DefinePlan()
8484
// we need to re-run this migration, as it was flawed for V14 RC3 (the migration can run twice without any issues)
8585
To<V_14_0_0.AddEditorUiToDataType>("{6FB5CA9E-C823-473B-A14C-FE760D75943C}");
8686
To<V_14_0_0.CleanUpDataTypeConfigurations>("{827360CA-0855-42A5-8F86-A51F168CB559}");
87-
To<V_14_0_0.MigrateRichTextConfiguration>("{FEF2DAF4-5408-4636-BB0E-B8798DF8F095}");
87+
88+
// To 14.1.0
89+
To<V_14_1_0.MigrateRichTextConfiguration>("{FEF2DAF4-5408-4636-BB0E-B8798DF8F095}");
90+
To<V_14_1_0.MigrateOldRichTextSeedConfiguration>("{A385C5DF-48DC-46B4-A742-D5BB846483BC}");
8891
}
8992
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using NPoco;
2+
using Umbraco.Cms.Core;
3+
using Umbraco.Cms.Infrastructure.Persistence;
4+
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
5+
using Umbraco.Extensions;
6+
7+
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_1_0;
8+
9+
public class MigrateOldRichTextSeedConfiguration : MigrationBase
10+
{
11+
private const string OldSeedValue =
12+
"{\"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|\"}";
13+
14+
private const string NewDefaultValue =
15+
"{\"toolbar\":[\"styles\",\"bold\",\"italic\",\"alignleft\",\"aligncenter\",\"alignright\",\"bullist\",\"numlist\",\"outdent\",\"indent\",\"sourcecode\",\"link\",\"umbmediapicker\",\"umbembeddialog\"],\"mode\":\"Classic\",\"maxImageSize\":500}";
16+
public MigrateOldRichTextSeedConfiguration(IMigrationContext context) : base(context)
17+
{
18+
}
19+
20+
protected override void Migrate()
21+
{
22+
Sql<ISqlContext> sql = Sql()
23+
.Select<DataTypeDto>()
24+
.From<DataTypeDto>()
25+
.Where<DataTypeDto>(x =>
26+
x.EditorAlias.Equals(Constants.PropertyEditors.Aliases.RichText)
27+
&& x.Configuration == OldSeedValue);
28+
29+
List<DataTypeDto> dataTypeDtos = Database.Fetch<DataTypeDto>(sql);
30+
31+
foreach (DataTypeDto dataTypeDto in dataTypeDtos)
32+
{
33+
// Update the configuration
34+
dataTypeDto.Configuration = NewDefaultValue;
35+
Database.Update(dataTypeDto);
36+
}
37+
}
38+
}

src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateRichTextConfiguration.cs renamed to src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_1_0/MigrateRichTextConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
55
using Umbraco.Extensions;
66

7-
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_0_0;
7+
namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_1_0;
88

99
public class MigrateRichTextConfiguration : MigrationBase
1010
{

0 commit comments

Comments
 (0)