Update tag import popup to new input

This commit is contained in:
Wolfsblvt 2024-06-27 02:52:34 +02:00
parent d737c0f285
commit d5016ad672
3 changed files with 8 additions and 16 deletions

View File

@ -221,6 +221,7 @@ export class Popup {
label.appendChild(inputElement);
const labelText = document.createElement('span');
labelText.innerText = input.label;
labelText.dataset.i18n = input.label;
label.appendChild(labelText);
if (input.tooltip) {

View File

@ -801,8 +801,7 @@ async function showTagImportPopup(character, existingTags, newTags, folderTags)
if (folderTags.length === 0) popupContent.find('#folder_tags_block').hide();
function onCloseRemember(/** @type {Popup} */ popup) {
const rememberCheckbox = document.getElementById('import_remember_option');
if (rememberCheckbox instanceof HTMLInputElement && rememberCheckbox.checked) {
if (popup.result && popup.inputResults.get('import_remember_option')) {
const setting = buttonSettingsMap[popup.result];
if (!setting) return;
power_user.tag_import_setting = setting;
@ -812,7 +811,12 @@ async function showTagImportPopup(character, existingTags, newTags, folderTags)
}
}
const result = await callGenericPopup(popupContent, POPUP_TYPE.TEXT, null, { wider: true, okButton: 'Import', cancelButton: true, customButtons: Object.values(importButtons), onClose: onCloseRemember });
const result = await callGenericPopup(popupContent, POPUP_TYPE.TEXT, null, {
wider: true, okButton: 'Import', cancelButton: true,
customButtons: Object.values(importButtons),
customInputs: [{ id: 'import_remember_option', label: 'Remember my choice', tooltip: 'Remember the chosen import option\nIf anything besides \'Cancel\' is selected, this dialog will not show up anymore.\nTo change this, go to the settings and modify "Tag Import Option".\n\nIf the "Import" option is chosen, the global setting will stay on "Ask".' }],
onClose: onCloseRemember
});
if (!result) {
return [];
}

View File

@ -19,17 +19,4 @@
</small>
<div id="import_folder_tags_list" class="tags" style="margin-top: 5px;"></div>
</div>
<small>
<label class="checkbox flex-container alignitemscenter flexNoGap m-t-3" for="import_remember_option">
<input type="checkbox" id="import_remember_option" name="import_remember_option" />
<span>
<span data-i18n="Remember my choice">Remember my choice</span>
<div class="fa-solid fa-circle-info opacity50p"
data-i18n="[title]Remember the chosen import option If anything besides 'Cancel' is selected, this dialog will not show up anymore. To change this, go to the settings and modify &quot;Tag Import Option&quot;. If the &quot;Import&quot; option is chosen, the global setting will stay on &quot;Ask&quot;."
title="Remember the chosen import option&#010;If anything besides 'Cancel' is selected, this dialog will not show up anymore.&#010;To change this, go to the settings and modify &quot;Tag Import Option&quot;.&#010;&#010;If the &quot;Import&quot; option is chosen, the global setting will stay on &quot;Ask&quot;.">
</div>
</span>
</label>
</small>
</div>