diff --git a/src/Umbraco.Core/PropertyEditors/SliderConfiguration.cs b/src/Umbraco.Core/PropertyEditors/SliderConfiguration.cs index 709fb3ce9f..4000af6b82 100644 --- a/src/Umbraco.Core/PropertyEditors/SliderConfiguration.cs +++ b/src/Umbraco.Core/PropertyEditors/SliderConfiguration.cs @@ -14,12 +14,12 @@ public class SliderConfiguration [ConfigurationField("initVal2", "Initial value 2", "number", Description = "Used when range is enabled")] public decimal InitialValue2 { get; set; } - [ConfigurationField("minVal", "Minimum value", "number")] + [ConfigurationField("minVal", "Minimum value", "number", Description = "Must be smaller than the Maximum value")] public decimal MinimumValue { get; set; } - [ConfigurationField("maxVal", "Maximum value", "number")] + [ConfigurationField("maxVal", "Maximum value", "number", Description = "Must be larger than the Minimum value")] public decimal MaximumValue { get; set; } - [ConfigurationField("step", "Step increments", "number")] + [ConfigurationField("step", "Step increments", "number", Description = "Must be a positive value")] public decimal StepIncrements { get; set; } } diff --git a/src/Umbraco.Core/PropertyEditors/SliderConfigurationEditor.cs b/src/Umbraco.Core/PropertyEditors/SliderConfigurationEditor.cs index 915e92d709..fbf45a9c41 100644 --- a/src/Umbraco.Core/PropertyEditors/SliderConfigurationEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/SliderConfigurationEditor.cs @@ -25,4 +25,19 @@ public class SliderConfigurationEditor : ConfigurationEditor ToConfigurationEditor(SliderConfiguration? configuration) + { + // negative step increments can be configured in the back-office. they will cause the slider to + // crash the entire back-office. as we can't configure min and max values for the number prevalue + // editor, we have to this instead to limit the damage. + // logically, the step increments should be inverted instead of hardcoding them to 1, but the + // latter might point people in the direction of their misconfiguration. + if (configuration?.StepIncrements <= 0) + { + configuration.StepIncrements = 1; + } + + return base.ToConfigurationEditor(configuration); + } } diff --git a/src/Umbraco.Infrastructure/PropertyEditors/GridPropertyIndexValueFactory.cs b/src/Umbraco.Infrastructure/PropertyEditors/GridPropertyIndexValueFactory.cs index cc3c912f4a..c190a7b6a8 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/GridPropertyIndexValueFactory.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/GridPropertyIndexValueFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. using System.Text; @@ -92,6 +92,6 @@ namespace Umbraco.Cms.Core.PropertyEditors [Obsolete("Use the overload that specifies availableCultures, scheduled for removal in v14")] public IEnumerable>> GetIndexValues(IProperty property, string? culture, string? segment, bool published) - => GetIndexValues(property, culture, segment, published); + => GetIndexValues(property, culture, segment, published, Enumerable.Empty()); } } diff --git a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs index 8f59681afc..053e98d9cb 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs @@ -328,6 +328,6 @@ public class RichTextPropertyEditor : DataEditor [Obsolete("Use the overload with the 'availableCultures' parameter instead, scheduled for removal in v14")] public IEnumerable>> GetIndexValues(IProperty property, string? culture, string? segment, bool published) - => GetIndexValues(property, culture, segment, published); + => GetIndexValues(property, culture, segment, published, Enumerable.Empty()); } }