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 @@ -408,10 +408,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
408408 onDragOver = { handle_drag_over }
409409 onDragEnd = { handle_drag_end }
410410 onFocus = { ( ) => set_is_focused ( true ) }
411- onBlur = { ( ) => {
412- set_is_focused ( false )
413- window . getSelection ( ) ?. removeAllRanges ( )
414- } }
411+ onBlur = { ( ) => set_is_focused ( false ) }
415412 className = { cn ( styles . input , {
416413 [ styles [ 'input--empty' ] ] : ! props . value
417414 } ) }
Original file line number Diff line number Diff line change @@ -185,32 +185,10 @@ export const use_ghost_text = ({
185185 if ( parent_node ) {
186186 parent_node . replaceChild ( text_node , ghost_node )
187187
188- let next_sibling = text_node . nextSibling
189- let space_added = false
190-
191- if (
192- ! next_sibling ||
193- next_sibling . nodeType !== Node . TEXT_NODE ||
194- ! next_sibling . textContent ?. startsWith ( ' ' )
195- ) {
196- const space_node = document . createTextNode ( ' ' )
197- if ( next_sibling ) {
198- parent_node . insertBefore ( space_node , next_sibling )
199- } else {
200- parent_node . appendChild ( space_node )
201- }
202- next_sibling = space_node
203- space_added = true
204- }
205-
206188 const selection = window . getSelection ( )
207189 if ( selection ) {
208190 const range = document . createRange ( )
209- if ( space_added ) {
210- range . setStartAfter ( next_sibling ! )
211- } else {
212- range . setStart ( next_sibling ! , 1 )
213- }
191+ range . setStartAfter ( text_node )
214192 range . collapse ( true )
215193 selection . removeAllRanges ( )
216194 selection . addRange ( range )
You can’t perform that action at this time.
0 commit comments