@@ -55,8 +55,10 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
55
55
if ( blockEditorValue == null )
56
56
return null ;
57
57
58
+ var allBlocks = blockEditorValue . Content . Concat ( blockEditorValue . Settings ) ;
59
+
58
60
// get all the content types used in block editor items
59
- var allContentTypes = blockEditorValue . Data . Select ( x => x . ContentTypeKey )
61
+ var allContentTypes = allBlocks . Select ( x => x . ContentTypeKey )
60
62
. Distinct ( )
61
63
. ToDictionary ( a => a , a =>
62
64
{
@@ -77,7 +79,7 @@ public string ToArtifact(object value, PropertyType propertyType, ICollection<Ar
77
79
dependencies . Add ( new ArtifactDependency ( contentType . GetUdi ( ) , false , ArtifactDependencyMode . Match ) ) ;
78
80
}
79
81
80
- foreach ( var block in blockEditorValue . Data )
82
+ foreach ( var block in allBlocks )
81
83
{
82
84
var contentType = allContentTypes [ block . ContentTypeKey ] ;
83
85
@@ -126,7 +128,9 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
126
128
if ( blockEditorValue == null )
127
129
return value ;
128
130
129
- var allContentTypes = blockEditorValue . Data . Select ( x => x . ContentTypeKey )
131
+ var allBlocks = blockEditorValue . Content . Concat ( blockEditorValue . Settings ) ;
132
+
133
+ var allContentTypes = allBlocks . Select ( x => x . ContentTypeKey )
130
134
. Distinct ( )
131
135
. ToDictionary ( a => a , a =>
132
136
{
@@ -141,7 +145,7 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
141
145
throw new InvalidOperationException ( $ "Could not resolve these content types for the Block Editor property: { string . Join ( "," , allContentTypes . Where ( x => x . Value == null ) . Select ( x => x . Key ) ) } ") ;
142
146
}
143
147
144
- foreach ( var block in blockEditorValue . Data )
148
+ foreach ( var block in allBlocks )
145
149
{
146
150
var contentType = allContentTypes [ block . ContentTypeKey ] ;
147
151
@@ -194,18 +198,32 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
194
198
/// "layout": {
195
199
/// "Umbraco.BlockList": [
196
200
/// {
197
- /// "udi ": "umb://element/b401bb800a4a48f79786d5079bc47718"
201
+ /// "contentUdi ": "umb://element/b401bb800a4a48f79786d5079bc47718"
198
202
/// }
199
203
/// ]
200
204
/// },
201
- /// "data ": [
205
+ /// "contentData ": [
202
206
/// {
203
207
/// "contentTypeKey": "5fe26fff-7163-4805-9eca-960b1f106bb9",
204
208
/// "udi": "umb://element/b401bb800a4a48f79786d5079bc47718",
205
209
/// "image": "umb://media/e28a0070890848079d5781774c3c5ffb",
206
210
/// "text": "hero text",
207
211
/// "contentpicker": "umb://document/87478d1efa66413698063f8d00fda1d1"
208
212
/// }
213
+ /// ],
214
+ /// "settingsData": [
215
+ /// {
216
+ /// "contentTypeKey": "2e6094ea-7bca-4b7c-a223-375254a194f4",
217
+ /// "udi": "umb://element/499cf69f00c84227a59ca10fb4ae4c9a",
218
+ /// "textColor": "",
219
+ /// "containerWidth": "standard",
220
+ /// "textWidth": [],
221
+ /// "height": [],
222
+ /// "overlayStrength": [],
223
+ /// "textAlignment": "left",
224
+ /// "verticalTextAlignment": "top",
225
+ /// "animate": "0"
226
+ /// }
209
227
/// ]
210
228
/// }
211
229
/// ]]>
@@ -222,14 +240,21 @@ public class BlockEditorValue
222
240
/// <summary>
223
241
/// This contains all the blocks created in the block editor.
224
242
/// </summary>
225
- [ JsonProperty ( "data" ) ]
226
- public IEnumerable < Block > Data { get ; set ; }
243
+ [ JsonProperty ( "contentData" ) ]
244
+ public IEnumerable < Block > Content { get ; set ; }
245
+
246
+ /// <summary>
247
+ /// This contains the settings associated with the block editor.
248
+ /// </summary>
249
+ [ JsonProperty ( "settingsData" ) ]
250
+ public IEnumerable < Block > Settings { get ; set ; }
227
251
}
228
252
229
253
public class Block
230
254
{
231
255
[ JsonProperty ( "contentTypeKey" ) ]
232
256
public string ContentTypeKey { get ; set ; }
257
+
233
258
[ JsonProperty ( "udi" ) ]
234
259
public string Udi { get ; set ; }
235
260
0 commit comments