Properly restore current char on import (nasty!)

This commit is contained in:
SillyLossy
2023-03-27 19:46:27 +03:00
parent b9a192c524
commit d18f005268

View File

@@ -2546,6 +2546,13 @@ function select_rm_info(text, charId = null) {
setRightTabSelectedClass(); setRightTabSelectedClass();
prev_selected_char = charId; prev_selected_char = charId;
if (prev_selected_char) {
const newId = characters.findIndex((x) => x.name == prev_selected_char);
if (newId >= 0) {
this_chid = newId;
}
}
} }
function select_selected_character(chid) { function select_selected_character(chid) {
@@ -2642,15 +2649,19 @@ function select_rm_create() {
} }
function select_rm_characters() { function select_rm_characters() {
restoreSelectedCharacter();
menu_type = "characters";
selectRightMenuWithAnimation('rm_characters_block');
setRightTabSelectedClass('rm_button_characters');
}
function restoreSelectedCharacter() {
if (prev_selected_char) { if (prev_selected_char) {
let newChId = characters.findIndex((x) => x.name == prev_selected_char); let newChId = characters.findIndex((x) => x.name == prev_selected_char);
$(`.character_select[chid="${newChId}"]`).trigger("click"); $(`.character_select[chid="${newChId}"]`).trigger("click");
prev_selected_char = null; prev_selected_char = null;
} }
menu_type = "characters";
selectRightMenuWithAnimation('rm_characters_block');
setRightTabSelectedClass('rm_button_characters');
} }
function setExtensionPrompt(key, value, position, depth) { function setExtensionPrompt(key, value, position, depth) {