1
1
using System . Collections . Generic ;
2
- using System . Linq ;
3
2
using Umbraco . Cms . Core ;
4
3
using Umbraco . Cms . Core . PropertyEditors ;
5
4
using Umbraco . Cms . Core . Semver ;
6
5
using Umbraco . Cms . Core . Serialization ;
7
6
using Umbraco . Deploy . Core ;
8
7
using Umbraco . Deploy . Infrastructure . Artifacts ;
9
- using Umbraco . Extensions ;
10
8
11
9
namespace Umbraco . Deploy . Contrib . Migrators . Legacy ;
12
10
@@ -23,7 +21,7 @@ public class TinyMCEv3DataTypeArtifactMigrator : LegacyReplaceDataTypeArtifactMi
23
21
/// <param name="propertyEditors">The property editors.</param>
24
22
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param>
25
23
public TinyMCEv3DataTypeArtifactMigrator ( PropertyEditorCollection propertyEditors , IConfigurationEditorJsonSerializer configurationEditorJsonSerializer )
26
- : base ( FromEditorAlias , Constants . PropertyEditors . Aliases . RichText , DeployConstants . PropertyEditors . UiAliases . TinyMce , propertyEditors , configurationEditorJsonSerializer )
24
+ : base ( FromEditorAlias , Constants . PropertyEditors . Aliases . RichText , DeployConstants . PropertyEditors . UiAliases . Tiptap , propertyEditors , configurationEditorJsonSerializer )
27
25
=> MaxVersion = new SemVersion ( 3 , 0 , 0 ) ;
28
26
29
27
/// <inheritdoc />
@@ -32,26 +30,55 @@ public TinyMCEv3DataTypeArtifactMigrator(PropertyEditorCollection propertyEditor
32
30
ReplaceUdiWithGuid ( ref configuration , "mediaParentId" ) ;
33
31
ReplaceRichTextEditor ( ref configuration ) ;
34
32
ReplaceIntegerWithBoolean ( ref configuration , Constants . DataTypes . ReservedPreValueKeys . IgnoreUserStartNodes ) ;
35
- configuration . TryAdd ( "toolbar " , new [ ]
33
+ configuration . TryAdd ( "extensions " , new [ ]
36
34
{
37
- "style" ,
38
- "bold" ,
39
- "italic" ,
40
- "alignleft" ,
41
- "aligncenter" ,
42
- "alignright" ,
43
- "bullist" ,
44
- "numlist" ,
45
- "outdent" ,
46
- "indent" ,
47
- "link" ,
48
- "sourcecode" ,
49
- "umbmediapicker" ,
50
- "umbembeddialog"
35
+ "Umb.Tiptap.Embed" ,
36
+ "Umb.Tiptap.Link" ,
37
+ "Umb.Tiptap.Figure" ,
38
+ "Umb.Tiptap.Image" ,
39
+ "Umb.Tiptap.Subscript" ,
40
+ "Umb.Tiptap.Superscript" ,
41
+ "Umb.Tiptap.Table" ,
42
+ "Umb.Tiptap.Underline" ,
43
+ "Umb.Tiptap.TextAlign" ,
44
+ "Umb.Tiptap.MediaUpload" ,
45
+ } ) ;
46
+ configuration . TryAdd ( "toolbar" , new string [ ] [ ] [ ]
47
+ {
48
+ [
49
+ [
50
+ "Umb.Tiptap.Toolbar.SourceEditor" ,
51
+ ] ,
52
+ [
53
+ "Umb.Tiptap.Toolbar.Bold" ,
54
+ "Umb.Tiptap.Toolbar.Italic" ,
55
+ "Umb.Tiptap.Toolbar.Underline" ,
56
+ ] ,
57
+ [
58
+ "Umb.Tiptap.Toolbar.TextAlignLeft" ,
59
+ "Umb.Tiptap.Toolbar.TextAlignCenter" ,
60
+ "Umb.Tiptap.Toolbar.TextAlignRight" ,
61
+ ] ,
62
+ [
63
+ "Umb.Tiptap.Toolbar.BulletList" ,
64
+ "Umb.Tiptap.Toolbar.OrderedList" ,
65
+ ] ,
66
+ [
67
+ "Umb.Tiptap.Toolbar.Blockquote" ,
68
+ "Umb.Tiptap.Toolbar.HorizontalRule" ,
69
+ ] ,
70
+ [
71
+ "Umb.Tiptap.Toolbar.Link" ,
72
+ "Umb.Tiptap.Toolbar.Unlink" ,
73
+ ] ,
74
+ [
75
+ "Umb.Tiptap.Toolbar.MediaPicker" ,
76
+ "Umb.Tiptap.Toolbar.EmbeddedMedia" ,
77
+ ] ,
78
+ ] ,
51
79
} ) ;
52
- configuration . TryAdd ( "mode" , "Classic" ) ;
53
80
configuration . TryAdd ( "maxImageSize" , 500 ) ;
54
- configuration . TryAdd ( "overlaySize" , "small " ) ;
81
+ configuration . TryAdd ( "overlaySize" , "medium " ) ;
55
82
56
83
return configuration ;
57
84
}
@@ -62,20 +89,14 @@ private void ReplaceRichTextEditor(ref IDictionary<string, object> configuration
62
89
{
63
90
if ( richTextEditorConfiguration . Toolbar is { Length : > 0 } )
64
91
{
65
- // Replace ace with sourcecode
66
- configuration [ "toolbar" ] = richTextEditorConfiguration . Toolbar . Select ( x => x == "ace" ? "sourcecode" : x ) . ToArray ( ) ;
92
+ // TODO: Map TinyMCE toolbar to Tiptap actions
67
93
}
68
94
69
95
if ( richTextEditorConfiguration . Stylesheets is { Length : > 0 } )
70
96
{
71
97
configuration [ "stylesheets" ] = richTextEditorConfiguration . Stylesheets ;
72
98
}
73
99
74
- if ( string . IsNullOrEmpty ( richTextEditorConfiguration . Mode ) is false )
75
- {
76
- configuration [ "mode" ] = richTextEditorConfiguration . Mode . ToFirstUpperInvariant ( ) ;
77
- }
78
-
79
100
if ( richTextEditorConfiguration . MaxImageSize is not null )
80
101
{
81
102
configuration [ "maxImageSize" ] = richTextEditorConfiguration . MaxImageSize ;
0 commit comments