mirror of
https://github.com/usememos/memos.git
synced 2025-10-18 02:07:09 +08:00
* fix: automatic indentation follows previous lines in lists (#4048) * fix: automatic indentation follows previous lines in lists (#4048) change the position of this logic and recommit it
This commit is contained in:
parent
2851f11302
commit
aa9649adf0
1 changed files with 5 additions and 1 deletions
|
@ -164,7 +164,11 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
|
|||
return;
|
||||
}
|
||||
|
||||
let insertText = "";
|
||||
// Get the indentation of the previous line
|
||||
const lines = prevContent.split("\n");
|
||||
const lastLine = lines[lines.length - 1];
|
||||
const indentationMatch = lastLine.match(/^\s*/);
|
||||
let insertText = indentationMatch ? indentationMatch[0] : ""; // Keep the indentation of the previous line
|
||||
if (lastNode.type === NodeType.TASK_LIST_ITEM) {
|
||||
const { symbol } = lastNode.taskListItemNode as TaskListItemNode;
|
||||
insertText = `${symbol} [ ] `;
|
||||
|
|
Loading…
Add table
Reference in a new issue