File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,9 @@ export default class WriteMarkdownEditor extends React.Component<
353
353
const lastNewLineIndex = sliced . lastIndexOf ( '\n' ) ;
354
354
const textBefore = sliced . slice ( 0 , lastNewLineIndex + 1 ) ;
355
355
const textAfter = markdown . slice ( lastNewLineIndex + 1 , markdown . length ) ;
356
- const currentNewLineIndex = textAfter . indexOf ( '\n' ) ;
356
+ let currentNewLineIndex = textAfter . indexOf ( '\n' ) ;
357
+ if ( currentNewLineIndex === - 1 ) currentNewLineIndex = textAfter . length ;
358
+
357
359
const lineText = textAfter . slice ( 0 , currentNewLineIndex ) ;
358
360
const textBelowCurrentLine = textAfter . slice (
359
361
currentNewLineIndex ,
@@ -366,6 +368,8 @@ export default class WriteMarkdownEditor extends React.Component<
366
368
this . appleEditorElement . current ! . selectionEnd = pos ;
367
369
} , 0 ) ;
368
370
} ;
371
+
372
+ console . log ( { lineText } ) ;
369
373
const handlers : {
370
374
[ key : string ] : ( ) => void ;
371
375
} = {
You can’t perform that action at this time.
0 commit comments