mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-25 20:51:09 +00:00
Resize article edit input based on length (fixes #51)
This commit is contained in:
parent
442e1ce75c
commit
8b08d99d99
3 changed files with 20 additions and 2 deletions
|
@ -39,6 +39,19 @@ pre {
|
||||||
white-space: pre-wrap;
|
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) {
|
@media only screen and (max-width: 720px) {
|
||||||
body {
|
body {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -3,6 +3,8 @@ set -e
|
||||||
|
|
||||||
IBIS__BIND="${IBIS_BIND:-"127.0.0.1:8081"}"
|
IBIS__BIND="${IBIS_BIND:-"127.0.0.1:8081"}"
|
||||||
|
|
||||||
|
killall trunk || true
|
||||||
|
|
||||||
# run processes in parallel
|
# run processes in parallel
|
||||||
# https://stackoverflow.com/a/52033580
|
# https://stackoverflow.com/a/52033580
|
||||||
(trap 'kill 0' INT;
|
(trap 'kill 0' INT;
|
||||||
|
|
|
@ -118,9 +118,10 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
}
|
}
|
||||||
set_text.set(article.article.text.clone());
|
set_text.set(article.article.text.clone());
|
||||||
let article_ = article.clone();
|
let article_ = article.clone();
|
||||||
|
let rows = article.article.text.lines().count() + 1;
|
||||||
view! {
|
view! {
|
||||||
// set initial text, otherwise submit with no changes results in empty text
|
// set initial text, otherwise submit with no changes results in empty text
|
||||||
<div class="item-view">
|
<div id="edit-article" class="item-view">
|
||||||
<h1>{article_title(&article.article)}</h1>
|
<h1>{article_title(&article.article)}</h1>
|
||||||
{move || {
|
{move || {
|
||||||
edit_error
|
edit_error
|
||||||
|
@ -130,7 +131,7 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<textarea on:keyup=move |ev| {
|
<textarea id="edit-article-textarea" rows=rows on:keyup=move |ev| {
|
||||||
let val = event_target_value(&ev);
|
let val = event_target_value(&ev);
|
||||||
set_text.update(|p| *p = val);
|
set_text.update(|p| *p = val);
|
||||||
}>{article.article.text.clone()}</textarea>
|
}>{article.article.text.clone()}</textarea>
|
||||||
|
@ -140,6 +141,7 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
</a>
|
</a>
|
||||||
" formatting is supported"
|
" formatting is supported"
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inputs">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Edit summary"
|
placeholder="Edit summary"
|
||||||
|
@ -166,6 +168,7 @@ pub fn EditArticle() -> impl IntoView {
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue