Skip to content

Commit 8ca637d

Browse files
authored
V14: Fix source code editor not showing on fresh install / upgrade (#16655)
* Create richtext with sourcecode by default * Add rich text migration * Create migration for migration "ace" value to "sourcecode"
1 parent 0b86863 commit 8ca637d

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ string GridCollectionView(string collectionViewType) =>
19341934
EditorUiAlias = "Umb.PropertyEditorUi.TinyMCE",
19351935
DbType = "Ntext",
19361936
Configuration =
1937-
"{\"toolbar\":[\"ace\",\"styles\",\"bold\",\"italic\",\"alignleft\",\"aligncenter\",\"alignright\",\"bullist\",\"numlist\",\"outdent\",\"indent\",\"link\",\"umbmediapicker\",\"umbembeddialog\"],\"stylesheets\":[],\"maxImageSize\":500,\"mode\":\"classic\"}",
1937+
"{\"toolbar\":[\"sourcecode\",\"styles\",\"bold\",\"italic\",\"alignleft\",\"aligncenter\",\"alignright\",\"bullist\",\"numlist\",\"outdent\",\"indent\",\"link\",\"umbmediapicker\",\"umbembeddialog\"],\"stylesheets\":[],\"maxImageSize\":500,\"mode\":\"classic\"}",
19381938
});
19391939
}
19401940

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@ 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}");
8788
}
8889
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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_0_0;
8+
9+
public class MigrateRichTextConfiguration : MigrationBase
10+
{
11+
12+
public MigrateRichTextConfiguration(IMigrationContext context) : base(context)
13+
{
14+
}
15+
16+
protected override void Migrate()
17+
{
18+
Sql<ISqlContext> sql = Sql()
19+
.Select<DataTypeDto>()
20+
.From<DataTypeDto>()
21+
.Where<DataTypeDto>(x => x.EditorAlias.Equals(Constants.PropertyEditors.Aliases.RichText));
22+
23+
List<DataTypeDto> dataTypeDtos = Database.Fetch<DataTypeDto>(sql);
24+
25+
foreach (DataTypeDto dataTypeDto in dataTypeDtos)
26+
{
27+
// Update the configuration
28+
dataTypeDto.Configuration = dataTypeDto.Configuration?.Replace("\"ace", "\"sourcecode");
29+
Database.Update(dataTypeDto);
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)