23 lines
565 B
OCaml
23 lines
565 B
OCaml
open Js_of_ocaml
|
|
open Js_of_ocaml_tyxml
|
|
open Lwt
|
|
open Store
|
|
|
|
let by_id s = Dom_html.getElementById s
|
|
|
|
let by_id_coerce s f =
|
|
Js.Opt.get
|
|
(f (Dom_html.getElementById s))
|
|
(fun () -> raise Not_found)
|
|
|
|
let do_by_id s f =
|
|
try f (Dom_html.getElementById s) with Not_found -> ()
|
|
|
|
let resize ~container ~textbox () =
|
|
Lwt.pause () >>= fun () ->
|
|
textbox##.style##.height := Js.string "auto";
|
|
textbox##.style##.height
|
|
:= Js.string (Printf.sprintf "%dpx" (max 18 textbox##.scrollHeight));
|
|
container##.scrollTop := container##.scrollHeight;
|
|
Lwt.return ()
|