Fix expand/collapse all entries

6dc20775079fc545f380b592b7cec5ab45457f46

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +11 -7Showing whitespace changes
public/script.js+1 -0
@@ -12051,6 +12051,7 @@ jQuery(async function () {
1205112051 const drawerContent = drawer.find('>.inline-drawer-content');
1205212052 icon.toggleClass('down up');
1205312053 icon.toggleClass('fa-circle-chevron-down fa-circle-chevron-up');
12054+ drawer.trigger('inline-drawer-toggle');
1205412055 drawerContent.stop().slideToggle({
1205512056 complete: () => {
1205612057 $(this).css('height', '');
public/scripts/utils.js+8 -6
@@ -2153,20 +2153,22 @@ export function getFreeName(name, list, numberFormatter = (n) => ` #${n}`) {
21532153 */
21542154export function toggleDrawer(drawer, expand = true) {
21552155 /** @type {HTMLElement} */
21562156 const icon = drawer.querySelector(':scope > .inline-drawer-header .inline-drawer-icon');
21572157 /** @type {HTMLElement} */
21582158 const content = drawer.querySelector(':scope > .inline-drawer-content');
21592159
21602160 if (expand) {
2161- icon.classList.remove('up', 'fa-circle-chevron-up');
2162- icon.classList.add('down', 'fa-circle-chevron-down');
2163- content.style.display = 'block';
2164- } else {
21652161 icon.classList.remove('down', 'fa-circle-chevron-down');
21662162 icon.classList.add('up', 'fa-circle-chevron-up');
2163+ content.style.display = 'block';
2164+ } else {
2165+ icon.classList.remove('up', 'fa-circle-chevron-up');
2166+ icon.classList.add('down', 'fa-circle-chevron-down');
21672167 content.style.display = 'none';
21682168 }
21692169
2170+ drawer.dispatchEvent(new CustomEvent('inline-drawer-toggle', { bubbles: true }));
2171+
21702172 // Set the height of "autoSetHeight" textareas within the inline-drawer to their scroll height
21712173 if (!CSS.supports('field-sizing', 'content')) {
21722174 content.querySelectorAll('textarea.autoSetHeight').forEach(resetScrollHeight);
public/scripts/world-info.js+2 -1
@@ -3034,7 +3034,7 @@ export async function getWorldEntry(name, data, entry) {
30343034
30353035 let drawerInitialized = false;
30363036 let drawerDestroyTimeout = null;
30373037 headerTemplate.find('.inline-drawer-toggle').on('clickinline-drawer-toggle', function () {
30383038 if (drawerDestroyTimeout) {
30393039 clearTimeout(drawerDestroyTimeout);
30403040 drawerDestroyTimeout = null;
@@ -3047,6 +3047,7 @@ export async function getWorldEntry(name, data, entry) {
30473047 }
30483048 drawerInitialized = false;
30493049 clearEntryList(editOutlet);
3050+ drawerDestroyTimeout = null;
30503051 }, debounce_timeout.relaxed);
30513052 } else {
30523053 drawerInitialized = true;