| 5406 | } | 5406 | } |
| 5407 | | 5407 | |
| 5408 | entryToMove.uid = newUid; | 5408 | entryToMove.uid = newUid; |
| 5409 | // Reset displayIndex or let it be recalculated based on target book's sorting? | 5409 | // Place the entry at the end of the target lorebook |
| 5410 | // For simplicity, let's assign a high index initially, assuming it might be sorted later. | | |
| 5411 | // Or maybe better, find the max displayIndex in target and add 1? | | |
| 5412 | const maxDisplayIndex = Object.values(targetData.entries).reduce((max, entry) => Math.max(max, entry.displayIndex ?? -1), -1); | 5410 | const maxDisplayIndex = Object.values(targetData.entries).reduce((max, entry) => Math.max(max, entry.displayIndex ?? -1), -1); |
| 5413 | entryToMove.displayIndex = maxDisplayIndex + 1; | 5411 | entryToMove.displayIndex = maxDisplayIndex + 1; |
| 5414 | | 5412 | |