change thread_view to a thread_preview with link

This commit is contained in:
Swrup 2022-01-09 11:28:18 +01:00
parent 0ad247c4be
commit 7330594dbf
12 changed files with 263 additions and 242 deletions

18
src/js_thread.ml Normal file
View file

@ -0,0 +1,18 @@
let log = Format.printf
(* called by clicking post_id to reply *)
(* insert id into reply form *)
let insert_quote post_id =
log "quote@.";
match Jv.(find global "replyComment") with
| None -> Jv.undefined
| Some comment_textarea ->
let content = Jv.get comment_textarea "value" in
let new_content =
Jv.call content "concat"
[| Jv.of_string ">>"; post_id; Jv.of_string " " |]
in
ignore @@ Jv.set comment_textarea "value" new_content;
Jv.undefined
let () = Jv.set Jv.global "insert_quote" (Jv.repr insert_quote)