fix bug with editing textarea
This commit is contained in:
parent
778a03ae88
commit
b8a6971363
1 changed files with 3 additions and 3 deletions
|
|
@ -13,15 +13,15 @@ let insert_quote el _event =
|
||||||
match find_by_id_opt "comment" with
|
match find_by_id_opt "comment" with
|
||||||
| None -> log "element `comment` not found, not logged in?@\n"
|
| None -> log "element `comment` not found, not logged in?@\n"
|
||||||
| Some textarea ->
|
| Some textarea ->
|
||||||
let inner_html = El.Prop.jstr (Jstr.of_string "innerHTML") in
|
let value = El.Prop.value in
|
||||||
let content = Jstr.to_string @@ El.prop inner_html textarea in
|
let content = Jstr.to_string @@ El.prop value textarea in
|
||||||
let new_content =
|
let new_content =
|
||||||
if String.ends_with ~suffix:"\n" content || String.length content = 0 then
|
if String.ends_with ~suffix:"\n" content || String.length content = 0 then
|
||||||
(* don't skip a line *)
|
(* don't skip a line *)
|
||||||
Format.sprintf "%s[>%s] " content emojid
|
Format.sprintf "%s[>%s] " content emojid
|
||||||
else Format.sprintf "%s@\n[>%s] " content emojid
|
else Format.sprintf "%s@\n[>%s] " content emojid
|
||||||
in
|
in
|
||||||
El.set_prop inner_html (Jstr.of_string new_content) textarea;
|
El.set_prop value (Jstr.of_string new_content) textarea;
|
||||||
El.set_has_focus true textarea
|
El.set_has_focus true textarea
|
||||||
|
|
||||||
(* make image description field visible when a file is selected*)
|
(* make image description field visible when a file is selected*)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue