mirror of
https://github.com/usememos/memos.git
synced 2025-02-21 21:57:47 +01: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
@ -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…
x
Reference in New Issue
Block a user