diff --git a/public/script.js b/public/script.js index 541887274..e956fd6d2 100644 --- a/public/script.js +++ b/public/script.js @@ -6317,13 +6317,12 @@ function importCharacter(file) { await getCharacters(); select_rm_info(`char_import`, data.file_name, oldSelectedChar); - let cur_context = getContext(); - console.log(cur_context); - //Find index of imported character base - let cur_index = cur_context.characters.findIndex(item => item.avatar === data.file_name + ".png"); - console.log(cur_index); - let imported_char = cur_context.characters[cur_index]; - importTags(imported_char); + if(power_user.import_card_tags){ + let currentContext = getContext(); + let avatarFileName = `${data.file_name}.png`; + let importedCharacter = currentContext.characters.find(character => character.avatar === avatarFileName); + importTags(importedCharacter); + } $("#rm_info_block").transition({ opacity: 1, duration: 1000 }); } }, diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 8d8f6d4f2..a08e01bbb 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -571,7 +571,7 @@ function loadPowerUserSettings(settings, data) { $(`#tokenizer option[value="${power_user.tokenizer}"]`).attr('selected', true); $(`#pygmalion_formatting option[value=${power_user.pygmalion_formatting}]`).attr("selected", true); $(`#send_on_enter option[value=${power_user.send_on_enter}]`).attr("selected", true); - $("#show_card_tags").prop("checked", power_user.show_card_tags); + $("#import_card_tags").prop("checked", power_user.import_card_tags); $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); $("#pin-examples-checkbox").prop("checked", power_user.pin_examples); $("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting); @@ -1314,8 +1314,8 @@ $(document).ready(() => { saveSettingsDebounced(); }); - $("#show_card_tags").on('input', function () { - power_user.show_card_tags = !!$(this).prop('checked'); + $("#import_card_tags").on('input', function () { + power_user.import_card_tags = !!$(this).prop('checked'); saveSettingsDebounced(); }); diff --git a/public/scripts/tags.js b/public/scripts/tags.js index 25f73896d..508faf2b6 100644 --- a/public/scripts/tags.js +++ b/public/scripts/tags.js @@ -215,6 +215,7 @@ function importTags(imported_char) { // add tag to the UI and internal map //appendTagToList(listSelector, tag, { removable: true }); addTagToMap(tag.id); + tag_map[imported_char.avatar].push(tag.id); }; saveSettingsDebounced(); printTags();