Update world-info.js

- make the rename button is also available in case of WIbook corruption.
- make the WI engine doesn't crash when certain entrys with `content === null`.
This commit is contained in:
steve green
2024-07-29 12:22:29 +08:00
committed by GitHub
parent 0c2df51e2c
commit 0693c9c400

View File

@@ -1761,8 +1761,11 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl
return;
}
// Regardless of whether success is displayed or not. Make sure the delete button is available.
// Regardless of whether success is displayed or not. Make sure the delete/rename button is available.
// Do not put this code behind.
$('#world_popup_name_button').off('click').on('click', async () => {
await renameWorldInfo(name, data);
});
$('#world_popup_delete').off('click').on('click', async () => {
const confirmation = await Popup.show.confirm(`Delete the World/Lorebook: "${name}"?`, 'This action is irreversible!');
if (!confirmation) {
@@ -1910,10 +1913,6 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl
if (entry) updateEditor(entry.uid);
});
$('#world_popup_name_button').off('click').on('click', async () => {
await renameWorldInfo(name, data);
});
$('#world_backfill_memos').off('click').on('click', async () => {
let counter = 0;
for (const entry of Object.values(data.entries)) {
@@ -3584,7 +3583,7 @@ export async function getSortedEntries() {
// Parse decorators
entries = entries.map((entry) => {
const [decorators, content] = parseDecorators(entry.content);
const [decorators, content] = parseDecorators(entry.content || '');
return { ...entry, decorators, content };
});