diff --git a/public/scripts/BulkEditOverlay.js b/public/scripts/BulkEditOverlay.js index d121d0fc6..a70cfe782 100644 --- a/public/scripts/BulkEditOverlay.js +++ b/public/scripts/BulkEditOverlay.js @@ -18,7 +18,7 @@ import { import { favsToHotswap } from './RossAscends-mods.js'; import { hideLoader, showLoader } from './loader.js'; import { convertCharacterToPersona } from './personas.js'; -import { createTagInput, getTagKeyForEntity, getTagsList, printTagList, tag_map, compareTagsForSort, removeTagFromMap } from './tags.js'; +import { createTagInput, getTagKeyForEntity, getTagsList, printTagList, tag_map, compareTagsForSort, removeTagFromMap, importTags } from './tags.js'; /** * Static object representing the actions of the @@ -219,6 +219,9 @@ class BulkTagPopupHandler { Mutual +
@@ -254,6 +257,18 @@ class BulkTagPopupHandler { document.querySelector('#bulk_tag_popup_reset').addEventListener('click', this.resetTags.bind(this)); document.querySelector('#bulk_tag_popup_remove_mutual').addEventListener('click', this.removeMutual.bind(this)); document.querySelector('#bulk_tag_popup_cancel').addEventListener('click', this.hide.bind(this)); + document.querySelector('#bulk_tag_popup_import_all_tags').addEventListener('click', this.importAllTags.bind(this)); + } + + /** + * Import all tags for all selected characters + */ + async importAllTags() { + for (const characterId of this.characterIds) { + await importTags(characters[characterId], { importAll: true }); + } + + $('#bulkTagList').empty(); } /** @@ -570,7 +585,7 @@ class BulkEditOverlay { this.container.removeEventListener('mouseup', cancelHold); this.container.removeEventListener('touchend', cancelHold); }, - BulkEditOverlay.longPressDelay); + BulkEditOverlay.longPressDelay); }; handleLongPressEnd = (event) => { diff --git a/public/scripts/tags.js b/public/scripts/tags.js index 43b52f74e..d563b00bc 100644 --- a/public/scripts/tags.js +++ b/public/scripts/tags.js @@ -708,12 +708,13 @@ const ANTI_TROLL_MAX_TAGS = 15; * * @param {Character} character - The character * @param {object} [options] - Options + * @param {boolean} [options.importAll=false] - Whether to import all tags without dialog * @param {boolean} [options.forceShow=false] - Whether to force showing the import dialog * @returns {Promise