File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -673,19 +673,18 @@ export class Outline extends Model {
673673 */
674674 private setFilter ( ) {
675675 // 还原 display
676- this . element . querySelectorAll ( " li.b3-list-item" ) . forEach ( ( item : HTMLElement ) => {
676+ this . element . querySelectorAll ( ' li.b3-list-item[style$="display: none;"]' ) . forEach ( ( item : HTMLElement ) => {
677677 item . style . display = "" ;
678678 } ) ;
679679 this . element . querySelectorAll ( "ul.fn__none" ) . forEach ( ( item ) => {
680- item . classList . remove ( "fn__none " ) ;
680+ item . previousElementSibling . querySelector ( ".b3-list-item__toggle" ) . classList . remove ( "fn__hidden " ) ;
681681 } ) ;
682682 const keyword = ( this . headerElement . querySelector ( "input.b3-text-field.search__label" ) as HTMLInputElement ) . value . toLowerCase ( ) ;
683683 if ( keyword ) {
684684 // 首次筛选时记录折叠状态
685685 if ( ! this . preFilterExpandIds ) {
686686 this . preFilterExpandIds = this . tree . getExpandIds ( ) ;
687687 }
688-
689688 const processUL = ( ul : Element ) => {
690689 let hasMatch = false ;
691690 let hasChildMatch = false ;
@@ -708,13 +707,13 @@ export class Outline extends Model {
708707 if ( nextUlElement ) {
709708 nextUlElement . classList . remove ( "fn__none" ) ;
710709 if ( childResult . hasMatch || childResult . hasChildMatch ) {
711- // 子项也有命中,保持展开状态,但隐藏未命中的子项由子级处理
710+ // 子项也有命中
712711 arrowElement . classList . add ( "b3-list-item__arrow--open" ) ;
713712 nextUlElement . classList . remove ( "fn__none" ) ;
714713 } else {
715- // 子项无命中,折叠所有子项但保持可展开
714+ // 子项无命中,折叠所有子项
716715 arrowElement . classList . remove ( "b3-list-item__arrow--open" ) ;
717- // 折叠但不完全隐藏,保持子项可访问性
716+ arrowElement . parentElement . classList . add ( "fn__hidden" ) ;
718717 nextUlElement . classList . add ( "fn__none" ) ;
719718 }
720719 }
You can’t perform that action at this time.
0 commit comments