mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update list padding
This commit is contained in:
@@ -29,25 +29,22 @@ const List: React.FC<Props> = ({ kind, indent, children }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getAttributes = () => {
|
const getAttributes = () => {
|
||||||
if (kind === ListNode_Kind.ORDERED) {
|
const attrs: any = {
|
||||||
const firstChild = head(children);
|
style: { paddingLeft: `${indent > 0 ? indent * 10 : 20}px` },
|
||||||
if (firstChild?.type === NodeType.ORDERED_LIST_ITEM) {
|
};
|
||||||
return {
|
const firstChild = head(children);
|
||||||
start: firstChild.orderedListItemNode?.number,
|
if (firstChild?.type === NodeType.ORDERED_LIST_ITEM) {
|
||||||
};
|
attrs.start = firstChild.orderedListItemNode?.number;
|
||||||
}
|
} else if (firstChild?.type === NodeType.TASK_LIST_ITEM) {
|
||||||
|
attrs.style = { paddingLeft: `${indent * 8}px` };
|
||||||
}
|
}
|
||||||
return {};
|
return attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
getListContainer(),
|
getListContainer(),
|
||||||
{
|
{
|
||||||
className: cn(
|
className: cn(kind === ListNode_Kind.ORDERED ? "list-decimal" : kind === ListNode_Kind.UNORDERED ? "list-disc" : "list-none"),
|
||||||
"list-inside break-all",
|
|
||||||
kind === ListNode_Kind.ORDERED ? "list-decimal" : kind === ListNode_Kind.UNORDERED ? "list-disc" : "list-none",
|
|
||||||
),
|
|
||||||
style: { paddingLeft: `${indent * 6}px` },
|
|
||||||
...getAttributes(),
|
...getAttributes(),
|
||||||
},
|
},
|
||||||
children.map((child, index) => {
|
children.map((child, index) => {
|
||||||
|
Reference in New Issue
Block a user