Merge pull request #1667 from LenAnderson/wi-duplicate
Add button to duplicate a World Info book
This commit is contained in:
commit
9b651a39eb
|
@ -2927,6 +2927,7 @@
|
||||||
<div id="world_backfill_memos" class="menu_button fa-solid fa-notes-medical" title="Fill empty Memo/Titles with Keywords" data-i18n="[title]Fill empty Memo/Titles with Keywords"></div>
|
<div id="world_backfill_memos" class="menu_button fa-solid fa-notes-medical" title="Fill empty Memo/Titles with Keywords" data-i18n="[title]Fill empty Memo/Titles with Keywords"></div>
|
||||||
<div id="world_import_button" class="menu_button fa-solid fa-file-import" title="Import World Info" data-i18n="[title]Import World Info"></div>
|
<div id="world_import_button" class="menu_button fa-solid fa-file-import" title="Import World Info" data-i18n="[title]Import World Info"></div>
|
||||||
<div id="world_popup_export" class="menu_button fa-solid fa-file-export" title="Export World Info" data-i18n="[title]Export World Info"></div>
|
<div id="world_popup_export" class="menu_button fa-solid fa-file-export" title="Export World Info" data-i18n="[title]Export World Info"></div>
|
||||||
|
<div id="world_duplicate" class="menu_button fa-solid fa-paste" title="Duplicate World Info" data-i18n="[title]Duplicate World Info"></div>
|
||||||
<div id="world_popup_delete" class="menu_button fa-solid fa-trash-can redWarningBG" title="Delete World Info" data-i18n="[title]Delete World Info"></div>
|
<div id="world_popup_delete" class="menu_button fa-solid fa-trash-can redWarningBG" title="Delete World Info" data-i18n="[title]Delete World Info"></div>
|
||||||
<input type="search" class="text_pole textarea_compact" data-i18n="[placeholder]Search..." id="world_info_search" placeholder="Search...">
|
<input type="search" class="text_pole textarea_compact" data-i18n="[placeholder]Search..." id="world_info_search" placeholder="Search...">
|
||||||
<select id="world_info_sort_order" class="margin0">
|
<select id="world_info_sort_order" class="margin0">
|
||||||
|
|
|
@ -558,6 +558,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
|
||||||
$('#world_popup_name_button').off('click').on('click', nullWorldInfo);
|
$('#world_popup_name_button').off('click').on('click', nullWorldInfo);
|
||||||
$('#world_popup_export').off('click').on('click', nullWorldInfo);
|
$('#world_popup_export').off('click').on('click', nullWorldInfo);
|
||||||
$('#world_popup_delete').off('click').on('click', nullWorldInfo);
|
$('#world_popup_delete').off('click').on('click', nullWorldInfo);
|
||||||
|
$('#world_duplicate').off('click').on('click', nullWorldInfo);
|
||||||
$('#world_popup_entries_list').hide();
|
$('#world_popup_entries_list').hide();
|
||||||
$('#world_info_pagination').html('');
|
$('#world_info_pagination').html('');
|
||||||
return;
|
return;
|
||||||
|
@ -695,6 +696,23 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#world_duplicate').off('click').on('click', async () => {
|
||||||
|
const tempName = getFreeWorldName();
|
||||||
|
const finalName = await callPopup('<h3>Create a new World Info?</h3>Enter a name for the new file:', 'input', tempName);
|
||||||
|
|
||||||
|
if (finalName) {
|
||||||
|
await saveWorldInfo(finalName, data, true);
|
||||||
|
await updateWorldInfoList();
|
||||||
|
|
||||||
|
const selectedIndex = world_names.indexOf(finalName);
|
||||||
|
if (selectedIndex !== -1) {
|
||||||
|
$('#world_editor_select').val(selectedIndex).trigger('change');
|
||||||
|
} else {
|
||||||
|
hideWorldEditor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#world_popup_delete').off('click').on('click', async () => {
|
$('#world_popup_delete').off('click').on('click', async () => {
|
||||||
const confirmation = await callPopup(`<h3>Delete the World/Lorebook: "${name}"?</h3>This action is irreversible!`, 'confirm');
|
const confirmation = await callPopup(`<h3>Delete the World/Lorebook: "${name}"?</h3>This action is irreversible!`, 'confirm');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue