1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2025-12-24 07:12:57 +00:00

Fixed "Export All" checkbox toggling incorrect items

This commit is contained in:
2025-07-27 19:58:19 +04:00
parent b956b6f7bc
commit 77293ba30c

View File

@@ -53,11 +53,25 @@
});
}
function toggleSelectionOnUserInput() {
requestAnimationFrame(() => {
$maintenanceProfiles.forEach(profile => exportedEntities.profiles[profile.id] = exportAllProfiles);
$tagGroups.forEach(group => exportedEntities.groups[group.id] = exportAllGroups);
});
/**
* Create a handler to toggle on or off specific entity type.
* @param targetEntity Code of the entity.
*/
function createToggleAllOnUserInput(targetEntity: keyof App.EntityNamesMap) {
return () => {
requestAnimationFrame(() => {
switch (targetEntity) {
case "profiles":
$maintenanceProfiles.forEach(profile => exportedEntities.profiles[profile.id] = exportAllProfiles);
break;
case "groups":
$tagGroups.forEach(group => exportedEntities.groups[group.id] = exportAllGroups);
break;
default:
console.warn(`Trying to toggle unsupported entity type: ${targetEntity}`);
}
});
}
}
function toggleExportedStringDisplay() {
@@ -74,7 +88,7 @@
<MenuItem href="/transporting" icon="arrow-left">Back</MenuItem>
<hr>
{#if $maintenanceProfiles.length}
<MenuCheckboxItem bind:checked={exportAllProfiles} oninput={toggleSelectionOnUserInput}>
<MenuCheckboxItem bind:checked={exportAllProfiles} oninput={createToggleAllOnUserInput('profiles')}>
Export All Profiles
</MenuCheckboxItem>
{#each $maintenanceProfiles as profile}
@@ -85,7 +99,7 @@
<hr>
{/if}
{#if $tagGroups.length}
<MenuCheckboxItem bind:checked={exportAllGroups} oninput={toggleSelectionOnUserInput}>
<MenuCheckboxItem bind:checked={exportAllGroups} oninput={createToggleAllOnUserInput('groups')}>
Export All Groups
</MenuCheckboxItem>
{#each $tagGroups as group}