mirror of
https://github.com/usememos/memos.git
synced 2025-12-15 13:27:20 +08:00
fix(web): markdown list auto-completion creates new line correctly
Fix issue where pressing Enter on a markdown list item would append the list symbol to the current line instead of creating a new line. The fix adds event.preventDefault() to stop the default Enter behavior and prepends a newline character to the inserted list continuation text. Fixes #5236
This commit is contained in:
parent
c54fcf7aa7
commit
5243e2963c
1 changed files with 2 additions and 1 deletions
|
|
@ -164,7 +164,8 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
|
|||
// Detect list item using regex-based detection
|
||||
const listInfo = detectLastListItem(prevContent);
|
||||
if (listInfo.type) {
|
||||
const insertText = generateListContinuation(listInfo);
|
||||
event.preventDefault();
|
||||
const insertText = "\n" + generateListContinuation(listInfo);
|
||||
editorActions.insertText(insertText);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue