From 8b08d99d99bbc70a65daff828656c866dcfe47c2 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 14 Oct 2024 11:24:06 +0200 Subject: [PATCH] Resize article edit input based on length (fixes #51) --- assets/ibis.css | 13 +++++++++++++ scripts/watch.sh | 2 ++ src/frontend/pages/article/edit.rs | 7 +++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/assets/ibis.css b/assets/ibis.css index dfc1b7e..b6db560 100644 --- a/assets/ibis.css +++ b/assets/ibis.css @@ -39,6 +39,19 @@ pre { white-space: pre-wrap; } +#edit-article textarea { + height: auto; + width: 100%; +} + +#edit-article .inputs { + display: flex; +} +#edit-article .inputs input { + flex: 1; + margin: 5px; +} + @media only screen and (max-width: 720px) { body { flex-direction: column; diff --git a/scripts/watch.sh b/scripts/watch.sh index 3de176c..04b41f3 100755 --- a/scripts/watch.sh +++ b/scripts/watch.sh @@ -3,6 +3,8 @@ set -e IBIS__BIND="${IBIS_BIND:-"127.0.0.1:8081"}" +killall trunk || true + # run processes in parallel # https://stackoverflow.com/a/52033580 (trap 'kill 0' INT; diff --git a/src/frontend/pages/article/edit.rs b/src/frontend/pages/article/edit.rs index 900057b..1b57d5a 100644 --- a/src/frontend/pages/article/edit.rs +++ b/src/frontend/pages/article/edit.rs @@ -118,9 +118,10 @@ pub fn EditArticle() -> impl IntoView { } set_text.set(article.article.text.clone()); let article_ = article.clone(); + let rows = article.article.text.lines().count() + 1; view! { // set initial text, otherwise submit with no changes results in empty text -
+

{article_title(&article.article)}

{move || { edit_error @@ -130,7 +131,7 @@ pub fn EditArticle() -> impl IntoView { }) }} - @@ -140,6 +141,7 @@ pub fn EditArticle() -> impl IntoView { " formatting is supported"
+
impl IntoView { Submit +
} })