precursor to better chatbar focus handling

This commit is contained in:
RossAscends
2023-04-22 21:24:57 +09:00
parent 544676ebe0
commit a4a71aab5b

View File

@ -203,6 +203,7 @@ let exportPopper = Popper.createPopper(document.getElementById('export_button'),
let dialogueResolve = null;
let chat_metadata = {};
let streamingProcessor = null;
let ChatBarInFocus = false;
const durationSaveEdit = 200;
@ -3750,8 +3751,11 @@ $(document).ready(function () {
if (is_send_press == false) {
is_send_press = true;
Generate();
if (ChatBarInFocus !== false) {
console.log("send_but -- refocusing chatbar");
$('#send_textarea').focus();
}
}
});
$("#send_textarea").keydown(function (e) {
@ -3762,6 +3766,16 @@ $(document).ready(function () {
}
});
$("#send_textarea").on('focus', function () {
ChatBarInFocus = true;
console.log('chatbar focused');
});
$("#send_textarea").on('blur', function () {
ChatBarInFocus = '';
console.log('chatbarInFocus set to ambiguous');
});
//menu buttons setup
$("#rm_button_settings").click(function () {
@ -4340,7 +4354,10 @@ $(document).ready(function () {
$("#options_button").click(function () {
// this is the options button click function, shows the options menu if closed
if (ChatBarInFocus !== false) {
console.log('options button - refocusing chatbar');
$("#send_textarea").focus();
}
if (
$("#options").css("display") === "none" &&
$("#options").css("opacity") == 0.0
@ -4361,7 +4378,10 @@ $(document).ready(function () {
$("#options [id]").on("click", function () {
var id = $(this).attr("id");
if (ChatBarInFocus !== false) {
console.log('options item - refocusing chatbar');
$("#send_textarea").focus();
}
if (id == "option_select_chat") {
if (selected_group) {
// will open a chat selection screen