芝麻web文件管理V1.00
编辑当前文件:/home/ephorei/www/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/table-of-contents.js
let scrollData = true; let scrollOffset = 30; let scrolltoTop = false; let scrollElement = null; let uagbTOCCollapseListener = true; UAGBTableOfContents = { _getDocumentElement() { let document_element = document; const getEditorIframe = document.querySelectorAll( 'iframe[name="editor-canvas"]' ); if( getEditorIframe?.length ){ const iframeDocument = getEditorIframe?.[0]?.contentWindow?.document || getEditorIframe?.[0]?.contentDocument; if ( iframeDocument ) { document_element = iframeDocument; } } return document_element; }, _setCollapseIconMargin ( id, attr ) { const document_collapsable = UAGBTableOfContents._getDocumentElement(); const block_element = document_collapsable.querySelector( id ); const uagbLoader = block_element.querySelector( '.uagb-toc__loader' ); // Get the first list item to compute the ::marker styles. const firstListItem = block_element.querySelector( 'li.uagb-toc__list:not(.uagb-toc__list--expandable)' ); if( firstListItem ) { const listFontSize = window.getComputedStyle( firstListItem ).fontSize; const listWrap = block_element.querySelector( '.uagb-toc__list-wrap' ); // Calculate the width for ::before pseudo-elements const widthValue = `calc(${listFontSize} / 3)`; // Check if a previous style element exists and remove it. // Escape periods in the id for use in querySelector or CSS. const escapedId = id?.replace( /\./g, '' ); // Ensure no existing stylesheets target the ID const existingStyleSheet = document_collapsable.querySelector( `#${escapedId}-toc-style` ); if ( existingStyleSheet ) { existingStyleSheet.remove(); // Remove the existing stylesheet if it exists. } // Create or append to the