fix textarea newline handle (#32966)
- Fix cursor position if input newline on middle of lines - ~Increment number if numbered list~  --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
abaeae0b9c
commit
1a7591d7f9
2 changed files with 20 additions and 5 deletions
|
@ -92,6 +92,7 @@ function handleNewline(textarea: HTMLTextAreaElement, e: Event) {
|
|||
if (!line) {
|
||||
// clear current line if we only have i.e. '1. ' and the user presses enter again to finish creating a list
|
||||
textarea.value = value.slice(0, lineStart) + value.slice(lineEnd);
|
||||
textarea.setSelectionRange(selStart - prefix.length, selStart - prefix.length);
|
||||
} else {
|
||||
// start a new line with the same indention and prefix
|
||||
let newPrefix = prefix;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue