From 0693c9c400145dce0f9fed5480e71160d3544eca Mon Sep 17 00:00:00 2001 From: steve green Date: Mon, 29 Jul 2024 12:22:29 +0800 Subject: [PATCH] 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`. --- public/scripts/world-info.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 1de1cd419..9053ec132 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -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 }; });