@@ -26,6 +26,7 @@ export class SearchFindInput extends ContextScopedFindInput {
26
26
private _filterChecked : boolean = false ;
27
27
private readonly _onDidChangeAIToggle = this . _register ( new Emitter < boolean > ( ) ) ;
28
28
public readonly onDidChangeAIToggle = this . _onDidChangeAIToggle . event ;
29
+ private shouldNotebookFilterBeVisible : boolean = false ; // followed, but overriden by the whether aiToggle is visible
29
30
30
31
constructor (
31
32
container : HTMLElement | null ,
@@ -66,25 +67,30 @@ export class SearchFindInput extends ContextScopedFindInput {
66
67
this . sparkleVisible = shouldShowAIButton ;
67
68
68
69
this . _register ( this . _aiButton . onChange ( ( ) => {
70
+ if ( this . regex ) {
71
+ this . regex . visible = ! this . _aiButton . checked ;
72
+ }
73
+ if ( this . wholeWords ) {
74
+ this . wholeWords . visible = ! this . _aiButton . checked ;
75
+ }
76
+ if ( this . caseSensitive ) {
77
+ this . caseSensitive . visible = ! this . _aiButton . checked ;
78
+ }
69
79
if ( this . _aiButton . checked ) {
70
- this . regex ?. disable ( ) ;
71
- this . wholeWords ?. disable ( ) ;
72
- this . caseSensitive ?. disable ( ) ;
73
- this . _findFilter . disable ( ) ;
80
+ this . _findFilter . visible = false ;
74
81
} else {
75
- this . regex ?. enable ( ) ;
76
- this . wholeWords ?. enable ( ) ;
77
- this . caseSensitive ?. enable ( ) ;
78
- this . _findFilter . enable ( ) ;
82
+ this . filterVisible = this . shouldNotebookFilterBeVisible ;
79
83
}
84
+ this . _updatePadding ( ) ;
85
+
80
86
} ) ) ;
81
87
}
82
88
83
89
private _updatePadding ( ) {
84
90
this . inputBox . paddingRight =
85
- ( this . caseSensitive ?. width ( ) ?? 0 ) +
86
- ( this . wholeWords ?. width ( ) ?? 0 ) +
87
- ( this . regex ?. width ( ) ?? 0 ) +
91
+ ( this . caseSensitive ?. visible ? this . caseSensitive . width ( ) : 0 ) +
92
+ ( this . wholeWords ?. visible ? this . wholeWords . width ( ) : 0 ) +
93
+ ( this . regex ?. visible ? this . regex . width ( ) : 0 ) +
88
94
( this . _findFilter . visible ? this . _findFilter . width ( ) : 0 ) +
89
95
( this . _aiButton . visible ? this . _aiButton . width ( ) : 0 ) ;
90
96
}
@@ -95,6 +101,10 @@ export class SearchFindInput extends ContextScopedFindInput {
95
101
}
96
102
97
103
set filterVisible ( visible : boolean ) {
104
+ this . shouldNotebookFilterBeVisible = visible ;
105
+ if ( this . _aiButton . visible && this . _aiButton . checked ) {
106
+ return ;
107
+ }
98
108
this . _findFilter . visible = visible ;
99
109
this . updateFilterStyles ( ) ;
100
110
this . _updatePadding ( ) ;
@@ -138,12 +148,4 @@ class AIToggle extends Toggle {
138
148
inputActiveOptionBackground : opts . inputActiveOptionBackground
139
149
} ) ;
140
150
}
141
-
142
- set visible ( visible : boolean ) {
143
- this . domNode . style . display = visible ? '' : 'none' ;
144
- }
145
-
146
- get visible ( ) {
147
- return this . domNode . style . display !== 'none' ;
148
- }
149
151
}
0 commit comments