File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -480,6 +480,7 @@ function multilineStyle(textarea: HTMLTextAreaElement, arg: StyleArgs) {
480
480
481
481
function orderedList(textarea: HTMLTextAreaElement): SelectionRange {
482
482
const orderedListRegex = /^\d+\.\s+/
483
+ const noInitialSelection = textarea.selectionStart === textarea.selectionEnd
483
484
let selectionEnd
484
485
let selectionStart
485
486
let text = textarea.value.slice(textarea.selectionStart, textarea.selectionEnd)
@@ -506,6 +507,7 @@ function orderedList(textarea: HTMLTextAreaElement): SelectionRange {
506
507
const {newlinesToAppend, newlinesToPrepend} = newlinesToSurroundSelectedText(textarea)
507
508
selectionStart = textarea.selectionStart + newlinesToAppend.length
508
509
selectionEnd = selectionStart + text.length
510
+ if (noInitialSelection) selectionStart = selectionEnd
509
511
text = newlinesToAppend + text + newlinesToPrepend
510
512
}
511
513
You can’t perform that action at this time.
0 commit comments