From a91c50c4280257f3c60ec5ba028081a84d79810b Mon Sep 17 00:00:00 2001 From: Swrup Date: Mon, 18 Apr 2022 03:21:56 +0200 Subject: [PATCH] autofocus textarea --- src/js/babillard.ml | 3 +++ src/js/post_form.ml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/babillard.ml b/src/js/babillard.ml index 075293d..80e1c40 100644 --- a/src/js/babillard.ml +++ b/src/js/babillard.ml @@ -5,6 +5,8 @@ open Map module Visibility = struct let new_thread_div = find_by_id "new-thread" + let thread_comment = find_by_id "thread-comment" + let thread_preview_div = find_by_id "thread-preview" let return_button = find_by_id "return-button" @@ -29,6 +31,7 @@ module Visibility = struct set_visible return_button; set_invisible thread_preview_div; Option.iter set_invisible new_thread_button; + El.set_has_focus true thread_comment; Leaflet.Map.close_popup ~popup:None map let to_babillard_mode _event = diff --git a/src/js/post_form.ml b/src/js/post_form.ml index 7fd606c..295721f 100644 --- a/src/js/post_form.ml +++ b/src/js/post_form.ml @@ -19,7 +19,8 @@ let insert_quote el _event = Format.sprintf "%s[>%s] " content emojid else Format.sprintf "%s@\n[>%s] " content emojid in - El.set_prop inner_html (Jstr.of_string new_content) textarea + El.set_prop inner_html (Jstr.of_string new_content) textarea; + El.set_has_focus true textarea let () = log "add inser_quote event on post links@\n";