Skip to content

Commit 10e56a5

Browse files
Zeegaanleekelleher
andauthored
V16: Removes TinyMCE (server-side) (#18913)
* Create new migration * Migrate UI to tiptap * remember to overwrite toolbar * Add setting to disable migration * Add default extensions when migrating * Remove places where editorUI alias is used * Remove more tinyMCE stuff * Make sure that blocks also works * Reverted files from bad merge * bring back value converters * Class name casing --------- Co-authored-by: leekelleher <[email protected]>
1 parent 3bd66b8 commit 10e56a5

File tree

13 files changed

+15
-134
lines changed

13 files changed

+15
-134
lines changed

src/Umbraco.Core/Constants-PropertyEditors.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@ public static class Aliases
170170
/// </summary>
171171
public const string RichText = "Umbraco.RichText";
172172

173-
/// <summary>
174-
/// TinyMCE
175-
/// </summary>
176-
[Obsolete("Please use RichText constant instead, scheduled for removal in v16")]
177-
public const string TinyMce = "Umbraco.TinyMCE";
178-
179173
/// <summary>
180174
/// Boolean.
181175
/// </summary>

src/Umbraco.Core/Models/Blocks/RichTextBlockValue.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,4 @@ public RichTextBlockValue(IEnumerable<RichTextBlockLayoutItem> layouts)
2323
/// <inheritdoc />
2424
[JsonIgnore]
2525
public override string PropertyEditorAlias => Constants.PropertyEditors.Aliases.RichText;
26-
27-
// RTE block layouts uses "Umbraco.TinyMCE" in V14 and below, but should use "Umbraco.RichText" for V15+
28-
[Obsolete("Will be removed in V18.")]
29-
public override bool SupportsBlockLayoutAlias(string alias)
30-
=> base.SupportsBlockLayoutAlias(alias) || alias.Equals(Constants.PropertyEditors.Aliases.TinyMce);
3126
}

src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleTinyMceValueConverter.cs renamed to src/Umbraco.Core/PropertyEditors/ValueConverters/SimpleRichtextValueConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters;
77
/// Value converter for the RTE so that it always returns IHtmlString so that Html.Raw doesn't have to be used.
88
/// </summary>
99
[DefaultPropertyValueConverter]
10-
public class SimpleTinyMceValueConverter : PropertyValueConverterBase
10+
public class SimpleRichTextValueConverter : PropertyValueConverterBase
1111
{
1212
public override bool IsConverter(IPublishedPropertyType propertyType)
1313
=> propertyType.EditorAlias == Constants.PropertyEditors.Aliases.RichText;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static IUmbracoBuilder AddCoreInitialServices(this IUmbracoBuilder builde
164164
// discovered when CoreBootManager configures the converters. We will remove the basic one defined
165165
// in core so that the more enhanced version is active.
166166
builder.PropertyValueConverters()
167-
.Remove<SimpleTinyMceValueConverter>();
167+
.Remove<SimpleRichTextValueConverter>();
168168

169169
// register *all* checks, except those marked [HideFromTypeFinder] of course
170170
builder.Services.AddSingleton<IMarkdownToHtmlConverter, MarkdownToHtmlConverter>();

src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddEditorUiToDataType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected override void Migrate()
6868
Constants.PropertyEditors.Aliases.TextBox => "Umb.PropertyEditorUi.TextBox",
6969
Constants.PropertyEditors.Aliases.TextArea => "Umb.PropertyEditorUi.TextArea",
7070
Constants.PropertyEditors.Aliases.RichText => "Umb.PropertyEditorUi.TinyMCE",
71-
Constants.PropertyEditors.Aliases.TinyMce => "Umb.PropertyEditorUi.TinyMCE",
71+
"Umbraco.TinyMCE" => "Umb.PropertyEditorUi.TinyMCE",
7272
Constants.PropertyEditors.Aliases.Boolean => "Umb.PropertyEditorUi.Toggle",
7373
Constants.PropertyEditors.Aliases.MarkdownEditor => "Umb.PropertyEditorUi.MarkdownEditor",
7474
Constants.PropertyEditors.Aliases.UserPicker => "Umb.PropertyEditorUi.UserPicker",

src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateDataTypeConfigurations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected override void Migrate()
102102
PropertyEditorAliases.RichText => HandleRichText(ref configurationData),
103103
PropertyEditorAliases.TextBox => HandleTextBoxAndTextArea(ref configurationData),
104104
PropertyEditorAliases.TextArea => HandleTextBoxAndTextArea(ref configurationData),
105-
PropertyEditorAliases.TinyMce => HandleRichText(ref configurationData),
105+
"Umbraco.TinyMCE" => HandleRichText(ref configurationData),
106106
PropertyEditorAliases.UploadField => HandleUploadField(ref configurationData),
107107
_ => false
108108
};

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public ConvertRichTextEditorProperties(
3131
}
3232

3333
protected override IEnumerable<string> PropertyEditorAliases
34-
=> new[] { Constants.PropertyEditors.Aliases.TinyMce, Constants.PropertyEditors.Aliases.RichText };
34+
=> new[] { "Umbraco.TinyMCE", Constants.PropertyEditors.Aliases.RichText };
3535

3636
protected override EditorValueHandling DetermineEditorValueHandling(object editorValue)
3737
=> editorValue is RichTextEditorValue richTextEditorValue

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/LocalLinks/LocalLinkRteProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class LocalLinkRteProcessor : ITypedLocalLinkProcessor
1111

1212
public IEnumerable<string> PropertyEditorAliases =>
1313
[
14-
Constants.PropertyEditors.Aliases.TinyMce, Constants.PropertyEditors.Aliases.RichText
14+
"Umbraco.TinyMCE", Constants.PropertyEditors.Aliases.RichText
1515
];
1616

1717
public Func<object?, Func<object?, bool>, Func<string, string>, bool> Process => ProcessRichText;

src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/RteBlockRenderingValueConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters;
2626
/// used dynamically.
2727
/// </summary>
2828
[DefaultPropertyValueConverter]
29-
public class RteBlockRenderingValueConverter : SimpleTinyMceValueConverter, IDeliveryApiPropertyValueConverter
29+
public class RteBlockRenderingValueConverter : SimpleRichTextValueConverter, IDeliveryApiPropertyValueConverter
3030
{
3131
private readonly HtmlImageSourceParser _imageSourceParser;
3232
private readonly HtmlLocalLinkParser _linkParser;

tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/BlockEditorBackwardsCompatibilityTests.cs

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -277,114 +277,6 @@ public async Task BlockGridIsBackwardsCompatible()
277277
});
278278
}
279279

280-
[TestCase]
281-
public async Task RichTextIsBackwardsCompatible()
282-
{
283-
var elementType = await CreateElementType();
284-
var richTextDataType = await CreateRichTextDataType(elementType);
285-
var contentType = await CreateContentType(richTextDataType);
286-
287-
var json = $$"""
288-
{
289-
"markup": "<p>huh?</p>",
290-
"blocks": {
291-
"layout": {
292-
"{{Constants.PropertyEditors.Aliases.TinyMce}}": [
293-
{
294-
"contentUdi": "umb://element/1304e1ddac87439684fe8a399231cb3d",
295-
"settingsUdi": "umb://element/1f613e26ce274898908a561437af5100"
296-
},
297-
{
298-
"contentUdi": "umb://element/0a4a416e547d464fabcc6f345c17809a",
299-
"settingsUdi": "umb://element/63027539b0db45e7b70459762d4e83dd"
300-
}
301-
]
302-
},
303-
"contentData": [
304-
{
305-
"contentTypeKey": "{{elementType.Key}}",
306-
"udi": "umb://element/1304e1ddac87439684fe8a399231cb3d",
307-
"title": "Content Title One",
308-
"text": "Content Text One"
309-
},
310-
{
311-
"contentTypeKey": "{{elementType.Key}}",
312-
"udi": "umb://element/0a4a416e547d464fabcc6f345c17809a",
313-
"title": "Content Title Two",
314-
"text": "Content Text Two"
315-
}
316-
],
317-
"settingsData": [
318-
{
319-
"contentTypeKey": "{{elementType.Key}}",
320-
"udi": "umb://element/1f613e26ce274898908a561437af5100",
321-
"title": "Settings Title One",
322-
"text": "Settings Text One"
323-
},
324-
{
325-
"contentTypeKey": "{{elementType.Key}}",
326-
"udi": "umb://element/63027539b0db45e7b70459762d4e83dd",
327-
"title": "Settings Title Two",
328-
"text": "Settings Text Two"
329-
}
330-
]
331-
}
332-
}
333-
""";
334-
335-
var contentBuilder = new ContentBuilder()
336-
.WithContentType(contentType)
337-
.WithName("Home");
338-
339-
var content = contentBuilder.Build();
340-
content.Properties["blocks"]!.SetValue(json);
341-
ContentService.Save(content);
342-
343-
var toEditor = richTextDataType.Editor!.GetValueEditor().ToEditor(content.Properties["blocks"]!) as RichTextEditorValue;
344-
Assert.IsNotNull(toEditor);
345-
Assert.IsNotNull(toEditor.Blocks);
346-
347-
Assert.Multiple(() =>
348-
{
349-
Assert.AreEqual(2, toEditor.Blocks.ContentData.Count);
350-
351-
Assert.AreEqual("1304e1ddac87439684fe8a399231cb3d", toEditor.Blocks.ContentData[0].Key.ToString("N"));
352-
Assert.AreEqual("0a4a416e547d464fabcc6f345c17809a", toEditor.Blocks.ContentData[1].Key.ToString("N"));
353-
354-
AssertValueEquals(toEditor.Blocks.ContentData[0], "title", "Content Title One");
355-
AssertValueEquals(toEditor.Blocks.ContentData[0], "text", "Content Text One");
356-
AssertValueEquals(toEditor.Blocks.ContentData[1], "title", "Content Title Two");
357-
AssertValueEquals(toEditor.Blocks.ContentData[1], "text", "Content Text Two");
358-
359-
Assert.IsFalse(toEditor.Blocks.ContentData[0].RawPropertyValues.Any());
360-
Assert.IsFalse(toEditor.Blocks.ContentData[1].RawPropertyValues.Any());
361-
});
362-
363-
Assert.Multiple(() =>
364-
{
365-
Assert.AreEqual(2, toEditor.Blocks.SettingsData.Count);
366-
367-
Assert.AreEqual("1f613e26ce274898908a561437af5100", toEditor.Blocks.SettingsData[0].Key.ToString("N"));
368-
Assert.AreEqual("63027539b0db45e7b70459762d4e83dd", toEditor.Blocks.SettingsData[1].Key.ToString("N"));
369-
370-
AssertValueEquals(toEditor.Blocks.SettingsData[0], "title", "Settings Title One");
371-
AssertValueEquals(toEditor.Blocks.SettingsData[0], "text", "Settings Text One");
372-
AssertValueEquals(toEditor.Blocks.SettingsData[1], "title", "Settings Title Two");
373-
AssertValueEquals(toEditor.Blocks.SettingsData[1], "text", "Settings Text Two");
374-
375-
Assert.IsFalse(toEditor.Blocks.SettingsData[0].RawPropertyValues.Any());
376-
Assert.IsFalse(toEditor.Blocks.SettingsData[1].RawPropertyValues.Any());
377-
});
378-
379-
Assert.Multiple(() =>
380-
{
381-
Assert.AreEqual(2, toEditor.Blocks.Expose.Count);
382-
383-
Assert.AreEqual("1304e1ddac87439684fe8a399231cb3d", toEditor.Blocks.Expose[0].ContentKey.ToString("N"));
384-
Assert.AreEqual("0a4a416e547d464fabcc6f345c17809a", toEditor.Blocks.Expose[1].ContentKey.ToString("N"));
385-
});
386-
}
387-
388280
private static void AssertValueEquals(BlockItemData blockItemData, string propertyAlias, string expectedValue)
389281
{
390282
var blockPropertyValue = blockItemData.Values.FirstOrDefault(v => v.Alias == propertyAlias);

tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/PropertyIndexValueFactoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using NUnit.Framework;
1+
using NUnit.Framework;
22
using Umbraco.Cms.Core;
33
using Umbraco.Cms.Core.Models;
44
using Umbraco.Cms.Core.Models.Blocks;
@@ -50,7 +50,7 @@ public void Can_Get_Index_Values_From_RichText_With_Blocks()
5050
Blocks = JsonSerializer.Deserialize<RichTextBlockValue>($$"""
5151
{
5252
"layout": {
53-
"Umbraco.TinyMCE": [{
53+
"Umbraco.RichText": [{
5454
"contentKey": "{{elementId:D}}"
5555
}
5656
]

tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void Can_Track_Block_References()
9898
Blocks = JsonSerializer.Deserialize<RichTextBlockValue>($$"""
9999
{
100100
"layout": {
101-
"Umbraco.TinyMCE": [{
101+
"{{Constants.PropertyEditors.Aliases.RichText}}": [{
102102
"contentKey": "{{elementId:D}}"
103103
}
104104
]
@@ -151,7 +151,7 @@ public void Can_Track_Block_Tags()
151151
Blocks = JsonSerializer.Deserialize<RichTextBlockValue>($$"""
152152
{
153153
"layout": {
154-
"Umbraco.TinyMCE": [{
154+
"{{Constants.PropertyEditors.Aliases.RichText}}": [{
155155
"contentKey": "{{elementId:D}}"
156156
}
157157
]

tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void Can_Parse_JObject()
3030
"markup": "<p>this is some markup</p><umb-rte-block data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf02\"><!--Umbraco-Block--></umb-rte-block>",
3131
"blocks": {
3232
"layout": {
33-
"Umbraco.TinyMCE": [{
33+
"Umbraco.RichText": [{
3434
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf02",
3535
"settingsKey": "d2eeef66-4111-42f4-a164-7a523eaffbc2"
3636
}
@@ -118,7 +118,7 @@ public void Can_Parse_Blocks_With_Both_Content_And_Settings()
118118
"markup": "<p>this is some markup</p><umb-rte-block data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf02\"><!--Umbraco-Block--></umb-rte-block>",
119119
"blocks": {
120120
"layout": {
121-
"Umbraco.TinyMCE": [{
121+
"Umbraco.RichText": [{
122122
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf02",
123123
"settingsKey": "d2eeef66-4111-42f4-a164-7a523eaffbc2"
124124
}
@@ -190,7 +190,7 @@ public void Can_Parse_Blocks_With_Content_Only()
190190
"markup": "<p>this is some markup</p><umb-rte-block data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf02\"></umb-rte-block>",
191191
"blocks": {
192192
"layout": {
193-
"Umbraco.TinyMCE": [{
193+
"Umbraco.RichText": [{
194194
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf02"
195195
}
196196
]
@@ -241,7 +241,7 @@ public void Can_Parse_Mixed_Blocks_And_Inline_Blocks()
241241
"markup": "<p>this is <umb-rte-block-inline data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf03\"></umb-rte-block-inline> some markup</p><umb-rte-block data-content-key=\"36cc710a-d8a6-45d0-a07f-7bbd8742cf02\"></umb-rte-block>",
242242
"blocks": {
243243
"layout": {
244-
"Umbraco.TinyMCE": [{
244+
"Umbraco.RichText": [{
245245
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf02"
246246
}, {
247247
"contentKey": "36cc710a-d8a6-45d0-a07f-7bbd8742cf03"

0 commit comments

Comments
 (0)