File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1616---
1717
1818<script type =" module " >
19- const LS_KEY = ' html-lit-react-snippets-index' ;
19+ const CLASS_KEY = ' html-lit-react-snippets' ;
20+ const LS_KEY = ` ${ CLASS_KEY } -index` ;
2021 document .addEventListener (' expand' , async function (event ) {
2122 const PfTabs = await customElements .whenDefined (' pf-tabs' );
2223 if (PfTabs .isExpandEvent (event )) {
23- const tabs = event .target .closest (' pf-tabs' );
24- await tabs .updateComplete ;
25- debugger ;
26- localStorage .setItem (LS_KEY , tabs .activeIndex );
27- update ();
24+ const tabs = event .tab .closest (' pf-tabs' );
25+ if (tabs .classList .contains (CLASS_KEY )) {
26+ await tabs .updateComplete ;
27+ localStorage .setItem (LS_KEY , tabs .activeIndex );
28+ update ();
29+ }
2830 }
2931 });
3032 async function update () {
31- for (const tabs of document .querySelectorAll (' pf-tabs.html-lit-react-snippets ' )) {
33+ for (const tabs of document .querySelectorAll (` pf-tabs.${ CLASS_KEY } ` )) {
3234 await tabs .updateComplete ;
3335 tabs .activeIndex = parseInt (localStorage .getItem (LS_KEY ) ?? ' 0' );
3436 }
You can’t perform that action at this time.
0 commit comments