From 6a5e34b24d4483786be68c19cac557a04761a182 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Fri, 15 Oct 2021 03:00:16 +0200 Subject: [PATCH] Allow switching property editor from numeric to slider (#11287) * Make it possible to change from numeric/decimal property editor to slider without breaking editor * Formatting --- .../views/propertyeditors/slider/slider.controller.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/slider/slider.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/slider/slider.controller.js index b0c3b88bc6c0..700f831f5af2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/slider/slider.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/slider/slider.controller.js @@ -45,8 +45,13 @@ if (!$scope.model.value) { $scope.model.value = start.toString(); } - // convert to array - $scope.sliderValue = $scope.model.value ? $scope.model.value.split(',') : null; + + // convert to array - exiting value can be a number if switching from numeric/decimal property editor + $scope.sliderValue = $scope.model.value + ? Utilities.isString($scope.model.value) || Utilities.isNumber($scope.model.value) + ? $scope.model.value.toString().split(',') + : null + : null; // don't render values with decimal places if the step increment in a whole number var stepDecimalPlaces = $scope.model.config.step % 1 == 0