mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Remove list items when list is toggled off (#13580)
GitOrigin-RevId: 19c63b26798fcf3c8e631090c614f0a693d4f071
This commit is contained in:
@@ -138,16 +138,16 @@ export const lastAncestorAtEndPosition = (
|
||||
export const descendantsOfNodeWithType = (
|
||||
node: SyntaxNode,
|
||||
type: string | number,
|
||||
nested = false
|
||||
leaveType?: string | number
|
||||
): SyntaxNode[] => {
|
||||
const children: SyntaxNode[] = []
|
||||
|
||||
node.cursor().iterate(nodeRef => {
|
||||
if (nodeRef.type.is(type)) {
|
||||
children.push(nodeRef.node)
|
||||
if (!nested) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (leaveType && nodeRef.type.is(leaveType) && nodeRef.node !== node) {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user