diff --git a/app-proto/main.css b/app-proto/main.css index 44dc7a1..32ae5bf 100644 --- a/app-proto/main.css +++ b/app-proto/main.css @@ -108,7 +108,7 @@ details[open]:has(li) .elt-switch::after { margin: 0px 8px 0px 0px; } -.cst > input[type=number] { +.cst > input[type=text] { color: #fcfcfc; background-color: inherit; border: 1px solid #555; diff --git a/app-proto/src/outline.rs b/app-proto/src/outline.rs index d6b0390..62bc529 100644 --- a/app-proto/src/outline.rs +++ b/app-proto/src/outline.rs @@ -138,22 +138,21 @@ pub fn Outline() -> View { input(r#type="checkbox", bind:checked=cst.active) div(class="cst-label") { (other_arg_label) } input( - r#type="number", - step="0.01", + r#type="text", bind:value=cst.rep_text, on:change=move |event: Event| { let target: HtmlInputElement = event.target().unwrap().unchecked_into(); - let rep_valid = target.check_validity() && !target.value().is_empty(); - batch(|| { - cst.rep_valid.set(rep_valid); - if rep_valid { + match target.value().parse::() { + Ok(rep) => batch(|| { + cst.rep.set(rep); + cst.rep_valid.set(true); console::log_2( &JsValue::from("Constraint rep parsed to"), - &JsValue::from(target.value_as_number()) + &JsValue::from(rep) ); - cst.rep.set(target.value_as_number()); - } - }); + }), + Err(_) => cst.rep_valid.set(false) + }; } ) }