mirror of
https://github.com/outline/outline.git
synced 2026-11-22 05:51:43 +03:00
19 lines
461 B
TypeScript
19 lines
461 B
TypeScript
import type { EditorState } from "prosemirror-state";
|
|
import { isNodeActive } from "./isNodeActive";
|
|
|
|
/**
|
|
* Returns true if the selection is inside a heading node.
|
|
*
|
|
* @param state The editor state.
|
|
* @returns True if the selection is inside a heading node.
|
|
*/
|
|
export function isInHeading(state: EditorState): boolean {
|
|
const { nodes } = state.schema;
|
|
|
|
if (nodes.heading && isNodeActive(nodes.heading)(state)) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|