Merge pull request #1253 from valden80/shift-open-char_wi

Force open char WI selector with Shift-click
This commit is contained in:
Cohee
2023-10-17 13:56:39 +03:00
committed by GitHub

View File

@@ -2065,7 +2065,7 @@ jQuery(() => {
}); });
$('#world_info_character_strategy').on('change', function () { $('#world_info_character_strategy').on('change', function () {
world_info_character_strategy = $(this).val(); world_info_character_strategy = Number($(this).val());
saveSettings(); saveSettings();
}); });
@@ -2080,19 +2080,19 @@ jQuery(() => {
saveSettings(); saveSettings();
}); });
$('#world_button').on('click', async function () { $('#world_button').on('click', async function (event) {
const chid = $('#set_character_world').data('chid'); const chid = $('#set_character_world').data('chid');
if (chid) { if (chid) {
const worldName = characters[chid]?.data?.extensions?.world; const worldName = characters[chid]?.data?.extensions?.world;
const hasEmbed = checkEmbeddedWorld(chid); const hasEmbed = checkEmbeddedWorld(chid);
if (worldName && world_names.includes(worldName)) { if (worldName && world_names.includes(worldName) && !event.shiftKey) {
if (!$('#WorldInfo').is(':visible')) { if (!$('#WorldInfo').is(':visible')) {
$('#WIDrawerIcon').trigger('click'); $('#WIDrawerIcon').trigger('click');
} }
const index = world_names.indexOf(worldName); const index = world_names.indexOf(worldName);
$("#world_editor_select").val(index).trigger('change'); $("#world_editor_select").val(index).trigger('change');
} else if (hasEmbed) { } else if (hasEmbed && !event.shiftKey) {
await importEmbeddedWorldInfo(); await importEmbeddedWorldInfo();
saveCharacterDebounced(); saveCharacterDebounced();
} }