diff --git a/appveyor.yml b/appveyor.yml index 5c7592f..1a88947 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ image: Visual Studio 2017 # version format -version: 1.1.0.{build} +version: 1.1.1.{build} # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta diff --git a/src/Our.Umbraco.InnerContent/PropertyEditors/InnerContentPropertyValueEditorWrapper.cs b/src/Our.Umbraco.InnerContent/PropertyEditors/InnerContentPropertyValueEditorWrapper.cs index 56bf6e4..185a92f 100644 --- a/src/Our.Umbraco.InnerContent/PropertyEditors/InnerContentPropertyValueEditorWrapper.cs +++ b/src/Our.Umbraco.InnerContent/PropertyEditors/InnerContentPropertyValueEditorWrapper.cs @@ -22,10 +22,9 @@ public override void ConfigureForDisplay(PreValueCollection preValues) { base.ConfigureForDisplay(preValues); - var asDictionary = preValues.PreValuesAsDictionary.ToDictionary(x => x.Key, x => x.Value.Value); - if (asDictionary.ContainsKey("hideLabel")) + if (preValues.PreValuesAsDictionary.ContainsKey("hideLabel")) { - var boolAttempt = asDictionary["hideLabel"].TryConvertTo(); + var boolAttempt = preValues.PreValuesAsDictionary["hideLabel"].Value.TryConvertTo(); if (boolAttempt.Success) { HideLabel = boolAttempt.Result; diff --git a/src/Our.Umbraco.InnerContent/PropertyEditors/SimpleInnerContentPropertyValueEditor.cs b/src/Our.Umbraco.InnerContent/PropertyEditors/SimpleInnerContentPropertyValueEditor.cs index 20087da..5414779 100644 --- a/src/Our.Umbraco.InnerContent/PropertyEditors/SimpleInnerContentPropertyValueEditor.cs +++ b/src/Our.Umbraco.InnerContent/PropertyEditors/SimpleInnerContentPropertyValueEditor.cs @@ -29,22 +29,19 @@ public override string ConvertDbToString(Property property, PropertyType propert return string.Empty; // Process value - ConvertDbToStringRecursive(value, property, propertyType, dataTypeService); + ConvertDbToStringRecursive(value, dataTypeService); - // Update the value on the property - property.Value = JsonConvert.SerializeObject(value); - - // Pass the call down - return base.ConvertDbToString(property, propertyType, dataTypeService); + // Return the serialized value + return JsonConvert.SerializeObject(value); } - protected void ConvertDbToStringRecursive(JToken token, Property property, PropertyType propertyType, IDataTypeService dataTypeService) + protected void ConvertDbToStringRecursive(JToken token, IDataTypeService dataTypeService) { if (token is JArray jArr) { foreach (var item in jArr) { - ConvertDbToStringRecursive(item, property, propertyType, dataTypeService); + ConvertDbToStringRecursive(item, dataTypeService); } } @@ -60,7 +57,7 @@ protected void ConvertDbToStringRecursive(JToken token, Property property, Prope { if (kvp.Value is JArray || kvp.Value is JObject) { - ConvertDbToStringRecursive(kvp.Value, property, propertyType, dataTypeService); + ConvertDbToStringRecursive(kvp.Value, dataTypeService); } } } @@ -82,22 +79,19 @@ public override object ConvertDbToEditor(Property property, PropertyType propert return string.Empty; // Process value - ConvertDbToEditorRecursive(value, property, propertyType, dataTypeService); + ConvertDbToEditorRecursive(value, dataTypeService); - // Update the value on the property - property.Value = JsonConvert.SerializeObject(value); - - // Pass the call down - return base.ConvertDbToEditor(property, propertyType, dataTypeService); + // Return the JObject, Angular can handle it directly + return value; } - protected void ConvertDbToEditorRecursive(JToken token, Property property, PropertyType propertyType, IDataTypeService dataTypeService) + protected void ConvertDbToEditorRecursive(JToken token, IDataTypeService dataTypeService) { if (token is JArray jArr) { foreach (var item in jArr) { - ConvertDbToEditorRecursive(item, property, propertyType, dataTypeService); + ConvertDbToEditorRecursive(item, dataTypeService); } } @@ -113,7 +107,7 @@ protected void ConvertDbToEditorRecursive(JToken token, Property property, Prope { if (kvp.Value is JArray || kvp.Value is JObject) { - ConvertDbToEditorRecursive(kvp.Value, property, propertyType, dataTypeService); + ConvertDbToEditorRecursive(kvp.Value, dataTypeService); } } } @@ -123,27 +117,31 @@ protected void ConvertDbToEditorRecursive(JToken token, Property property, Prope public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue) { // Convert / validate value - if (editorValue.Value == null || string.IsNullOrWhiteSpace(editorValue.Value.ToString())) - return null; + if (editorValue.Value == null) + return string.Empty; - var value = JsonConvert.DeserializeObject(editorValue.Value.ToString()); + var dbValue = editorValue.Value.ToString(); + if (string.IsNullOrWhiteSpace(dbValue)) + return string.Empty; + + var value = JsonConvert.DeserializeObject(dbValue); if (value == null || (value is JArray && ((JArray)value).Count == 0)) - return null; + return string.Empty; // Process value - ConvertEditorToDbRecursive(value, editorValue, currentValue); + ConvertEditorToDbRecursive(value, currentValue); // Return value return JsonConvert.SerializeObject(value); } - protected void ConvertEditorToDbRecursive(JToken token, ContentPropertyData editorValue, object currentValue) + protected void ConvertEditorToDbRecursive(JToken token, object currentValue) { if (token is JArray jArr) { foreach (var item in jArr) { - ConvertEditorToDbRecursive(item, editorValue, currentValue); + ConvertEditorToDbRecursive(item, currentValue); } } @@ -159,7 +157,7 @@ protected void ConvertEditorToDbRecursive(JToken token, ContentPropertyData edit { if (kvp.Value is JArray || kvp.Value is JObject) { - ConvertEditorToDbRecursive(kvp.Value, editorValue, currentValue); + ConvertEditorToDbRecursive(kvp.Value, currentValue); } } } diff --git a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.dialog.html b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.dialog.html index 3e2dd49..439518f 100644 --- a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.dialog.html +++ b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.dialog.html @@ -7,7 +7,7 @@ - +