File tree Expand file tree Collapse file tree 3 files changed +6
-14
lines changed
compass-generative-ai/src/components
compass-query-bar/src/components Expand file tree Collapse file tree 3 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ function createAIPlaceholderHTMLPlaceholder({
135135 darkMode ?: boolean ;
136136 placeholderText : string ;
137137 track : TrackFunction ;
138- } ) : HTMLElement {
138+ } ) : ( ) => HTMLElement {
139139 const containerEl = document . createElement ( 'div' ) ;
140140
141141 const placeholderTextEl = document . createTextNode ( `${ placeholderText } or ` ) ;
@@ -171,17 +171,9 @@ ${getAIEntrySVGString()}`;
171171
172172 containerEl . appendChild ( aiButtonEl ) ;
173173
174- // Workarond for https://github.com/codemirror/dev/issues/1519: codemirror
175- // will try to `cloneNode` the placeholder (for somewhat good reasons) which
176- // doesn't carry over the events we attach. There's no way to opt-out of this
177- // behavior, so we're just overriding cloneNode function to stop this from
178- // happening. This is covered by tests, so in case it stops working, we will
179- // know
180- containerEl . cloneNode = ( ) => {
181- return containerEl ;
182- } ;
183-
184- return containerEl ;
174+ // Return a function to prevent codemirror from cloning the DOM node (this
175+ // doesn't transfer event listeners)
176+ return ( ) => containerEl ;
185177}
186178
187179export { AIExperienceEntry , createAIPlaceholderHTMLPlaceholder } ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ type OptionEditorProps = {
8888 onChange : ( value : string ) => void ;
8989 onApply ?( ) : void ;
9090 onBlur ?( ) : void ;
91- placeholder ?: string | HTMLElement ;
91+ placeholder ?: string | ( ( ) => HTMLElement ) ;
9292 serverVersion ?: string ;
9393 value ?: string ;
9494 [ 'data-testid' ] ?: string ;
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ type QueryOptionProps = {
8787 value ?: string ;
8888 hasError : boolean ;
8989 onChange : ( name : QueryBarProperty , value : string ) => void ;
90- placeholder ?: string | HTMLElement ;
90+ placeholder ?: string | ( ( ) => HTMLElement ) ;
9191 onApply ?( ) : void ;
9292 disabled ?: boolean ;
9393} ;
You can’t perform that action at this time.
0 commit comments