From 587a260c2b7c6660e456e916269c80618a673bd4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 7 Feb 2022 12:04:21 +0000 Subject: [PATCH] Improve text area and long form height settings --- packages/bbui/src/Form/Core/TextArea.svelte | 16 ++++++++++++++-- packages/bbui/src/Markdown/MarkdownEditor.svelte | 2 +- packages/bbui/src/Markdown/SpectrumMDE.svelte | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/bbui/src/Form/Core/TextArea.svelte b/packages/bbui/src/Form/Core/TextArea.svelte index b615e97bff..465212cd44 100644 --- a/packages/bbui/src/Form/Core/TextArea.svelte +++ b/packages/bbui/src/Form/Core/TextArea.svelte @@ -22,11 +22,23 @@ dispatch("change", event.target.value) focus = false } + + const getStyleString = (attribute, value) => { + if (!attribute || value == null) { + return "" + } + if (isNaN(value)) { + return `${attribute}:${value};` + } + return `${attribute}:${value}px;` + } + + $: heightString = getStyleString("height", height) + $: minHeightString = getStyleString("min-height", minHeight)
{ - height = height || "300px" + height = height || "200px" mde = new EasyMDE({ element, spellChecker: false,