From 4226bd2daf9e5d4faaaf4164d0b62ea8d11d00c8 Mon Sep 17 00:00:00 2001 From: Valentin Serra Date: Tue, 13 Feb 2024 05:21:36 +0100 Subject: [PATCH] fix: validate instead of automatically resetting height entries Closes #956 --- .../src/features/properties-panel/entries/HeightEntry.js | 7 +++---- .../features/properties-panel/entries/IFrameHeightEntry.js | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/form-js-editor/src/features/properties-panel/entries/HeightEntry.js b/packages/form-js-editor/src/features/properties-panel/entries/HeightEntry.js index 0d1a1179d..94ac27946 100644 --- a/packages/form-js-editor/src/features/properties-panel/entries/HeightEntry.js +++ b/packages/form-js-editor/src/features/properties-panel/entries/HeightEntry.js @@ -41,13 +41,12 @@ function Height(props) { description, editField, field, - id, - defaultValue = 60 // default value for spacer + id } = props; const debounce = useService('debounce'); - const getValue = (e) => get(field, [ 'height' ], defaultValue); + const getValue = (e) => get(field, [ 'height' ], null); const setValue = (value, error) => { if (error) { @@ -77,7 +76,7 @@ function Height(props) { */ const validate = (value) => { if (typeof value !== 'number') { - return null; + return 'A number is required.'; } if (!Number.isInteger(value)) { diff --git a/packages/form-js-editor/src/features/properties-panel/entries/IFrameHeightEntry.js b/packages/form-js-editor/src/features/properties-panel/entries/IFrameHeightEntry.js index f1a69a1d1..8a4961b60 100644 --- a/packages/form-js-editor/src/features/properties-panel/entries/IFrameHeightEntry.js +++ b/packages/form-js-editor/src/features/properties-panel/entries/IFrameHeightEntry.js @@ -4,7 +4,6 @@ export function IFrameHeightEntry(props) { return [ ...HeightEntry({ ...props, - defaultValue: 300, description: 'Height of the container in pixels.', isDefaultVisible: (field) => field.type === 'iframe' })