in src/ts/richtext/utils/listsHelpers.ts [12:23]
export function isInNode(
state: EditorState,
nodeType: NodeType
) {
const { $from, $to } = state.selection;
const types = [nodeType];
const range = $from.blockRange(
$to,
(node) => types.indexOf(node.type) !== -1
);
return !!range && range.parent.type === nodeType;
}