File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel/PromptField Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11.container {
2- --padding : 5px 22 px 5 px 7px ;
2+ --padding : 5px 7px ;
33 position : relative ;
44
55 & __inner {
112112}
113113
114114.clear-button {
115- position : absolute ;
116- top : 0 ;
117- right : 0 ;
118- z-index : 2 ;
115+ float : right ;
116+ position : relative ;
119117 width : 18px ;
120- display : flex ;
121- align-items : center ;
122- justify-content : center ;
123118 cursor : pointer ;
124119 color : var (--vscode-icon-foreground );
125120 opacity : var (--dimmed-opacity );
126- padding-bottom : 6 px ;
127- line-height : 0 ;
121+ transform : translate ( 5 px , -3 px ) ;
122+ padding-bottom : 2 px ;
128123
129124 & ::before {
130125 font-size : 13px !important ;
Original file line number Diff line number Diff line change @@ -355,17 +355,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
355355 />
356356 ) }
357357 < div className = { styles [ 'input-wrapper' ] } >
358- { props . value && (
359- < button
360- className = { cn ( styles [ 'clear-button' ] , 'codicon' , 'codicon-close' ) }
361- onClick = { ( ) => {
362- set_should_show_ghost_text ( false )
363- handle_clear ( )
364- input_ref . current ?. focus ( )
365- } }
366- title = "Clear"
367- />
368- ) }
369358 < div
370359 ref = { input_ref }
371360 contentEditable = { true }
Original file line number Diff line number Diff line change @@ -662,6 +662,7 @@ export const use_handlers = (
662662 const target = e . target as HTMLElement
663663 const icon_element = target . closest ( '[data-role="symbol-icon"]' )
664664 const text_element = target . closest ( '[data-role="symbol-text"]' )
665+ const clear_button = target . closest ( '[data-role="clear-button"]' )
665666
666667 if ( icon_element ) {
667668 e . preventDefault ( )
@@ -745,6 +746,13 @@ export const use_handlers = (
745746 }
746747 }
747748
749+ if ( input_ref . current ) {
750+ input_ref . current . focus ( )
751+ }
752+ } else if ( clear_button ) {
753+ e . preventDefault ( )
754+ e . stopPropagation ( )
755+ handle_clear ( )
748756 if ( input_ref . current ) {
749757 input_ref . current . focus ( )
750758 }
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export const get_highlighted_text = (params: {
7474 )
7575 const parts = params . text . split ( regex )
7676
77- const result = parts
77+ let result = parts
7878 . map ( ( part ) => {
7979 const fragment_match = part . match (
8080 / ^ < f r a g m e n t p a t h = " ( [ ^ " ] + ) " (?: s t a r t = " ( [ ^ " ] + ) " ) ? (?: e n d = " ( [ ^ " ] + ) " ) ? > ( [ \s \S ] * ?) < \/ f r a g m e n t > $ /
@@ -265,6 +265,15 @@ export const get_highlighted_text = (params: {
265265 } )
266266 . join ( '' )
267267
268+ if ( params . text ) {
269+ result =
270+ `<span class="${ cn (
271+ styles [ 'clear-button' ] ,
272+ 'codicon' ,
273+ 'codicon-close'
274+ ) } " contenteditable="false" data-role="clear-button"></span>` + result
275+ }
276+
268277 if ( params . text . endsWith ( '\n' ) ) {
269278 return result + '<br data-role="trailing-break">'
270279 }
You can’t perform that action at this time.
0 commit comments