Skip to content

Commit 4918a9e

Browse files
fix(core): correctly reset PTE list counts after non-numbered lists and in sublists (#7506)
* fix(core): reset list count for sub-list items * fixup! fix(core): reset list count for sub-list items --------- Co-authored-by: Christian Hamburger Grøngaard <[email protected]>
1 parent 9a646d8 commit 4918a9e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/sanity/src/core/form/inputs/PortableText/Editor.styles.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export const EditableWrapper = styled(Card)<{$isFullscreen: boolean; $readOnly?:
9595
& > .pt-list-item-bullet + .pt-list-item-number,
9696
& > .pt-list-item-number + .pt-list-item-bullet {
9797
margin-top: ${({theme}) => theme.sanity.space[3]}px;
98-
counter-reset: ${TEXT_LEVELS.map((l) => createListName(l)).join(' ')};
9998
}
10099
101100
& > :not(.pt-list-item) + .pt-list-item {
@@ -107,13 +106,12 @@ export const EditableWrapper = styled(Card)<{$isFullscreen: boolean; $readOnly?:
107106
counter-set: ${TEXT_LEVELS.map((l) => createListName(l)).join(' ')};
108107
}
109108
110-
${TEXT_LEVELS.slice(1).map((l) => {
111-
return css`
112-
& > .pt-list-item-level-${l} + .pt-list-item-level-${l - 1} {
113-
counter-reset: ${createListName(l)};
114-
}
115-
`
116-
})}
109+
/* Reset the list count all the sub-list items */
110+
& > .pt-list-item-number.pt-list-item-level-${TEXT_LEVELS[0]} {
111+
counter-set: ${TEXT_LEVELS.slice(1)
112+
.map((l) => createListName(l))
113+
.join(' ')};
114+
}
117115
118116
& > .pt-list-item + :not(.pt-list-item) {
119117
margin-top: ${({theme}) => theme.sanity.space[3]}px;

0 commit comments

Comments
 (0)