File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
packages/richtext-lexical/src/features/link/client/plugins/autoLink Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,13 @@ function $createAutoLinkNode_(
187
187
188
188
const linkNode = $createAutoLinkNode ( { fields } )
189
189
if ( nodes . length === 1 ) {
190
- const split = (
191
- startIndex === 0 ? nodes [ 0 ] ?. splitText ( endIndex ) : nodes [ 0 ] ?. splitText ( startIndex , endIndex )
192
- ) !
193
-
194
- const [ linkTextNode , remainingTextNode ] = split
190
+ const remainingTextNode = nodes [ 0 ] !
191
+ let linkTextNode : TextNode | undefined
192
+ if ( startIndex === 0 ) {
193
+ ; [ linkTextNode ] = remainingTextNode . splitText ( endIndex )
194
+ } else {
195
+ ; [ , linkTextNode ] = remainingTextNode . splitText ( startIndex , endIndex )
196
+ }
195
197
if ( linkTextNode ) {
196
198
const textNode = $createTextNode ( match . text )
197
199
textNode . setFormat ( linkTextNode . getFormat ( ) )
You can’t perform that action at this time.
0 commit comments