Files
outline/shared/editor/queries/getParentListItem.ts
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

13 lines
411 B
TypeScript

import type { Node } from "prosemirror-model";
import type { EditorState } from "prosemirror-state";
export function getParentListItem(state: EditorState): [Node, number] | void {
const $head = state.selection.$head;
for (let d = $head.depth; d > 0; d--) {
const node = $head.node(d);
if (["list_item", "checkbox_item"].includes(node.type.name)) {
return [node, $head.before(d)];
}
}
}