From 1bdbdb234926764fd9097f3621f878f749e6b4c7 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 23 Nov 2021 16:13:48 -0500 Subject: [PATCH] content editable window with focus and cursor --- webcit-ng/static/js/view_forum.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/webcit-ng/static/js/view_forum.js b/webcit-ng/static/js/view_forum.js index 464e59a4a..823c983f3 100644 --- a/webcit-ng/static/js/view_forum.js +++ b/webcit-ng/static/js/view_forum.js @@ -216,7 +216,7 @@ function open_reply_box(prefix, msgnum, is_quoted) { "
" // end header - + "
" // begin body + + "
" // begin body + "This is where the reply text will go." + "
" // end body @@ -252,4 +252,17 @@ function open_reply_box(prefix, msgnum, is_quoted) { document.getElementById(new_div_name).innerHTML = replybox; document.getElementById(new_div_name).scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}); + + // This puts the focus and cursor in the edit box. + setTimeout(function() { + var tag = document.getElementById("ctdl-editor-body"); + + // Set cursor on focus + tag.focus(); + + // cursor + var sel = window.getSelection(); + sel.collapse(tag.firstChild, 0); + + }, 0); } -- 2.39.2