Files
outline/shared/editor/queries/isInNotice.ts
YouLLandTom Moor 59abc3355c feat: change notice type (#8533)
* feat: change notice type

* Apply suggestions from code review

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* refactor: change enum naming

* fix: notice creation

* fix: menu name

* refactor: put notice type in the menu label

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
2025-02-22 17:07:02 -08:00

14 lines
435 B
TypeScript

import { EditorState } from "prosemirror-state";
import { isNodeActive } from "./isNodeActive";
/**
* Returns true if the selection is inside a notice block.
*
* @param state The editor state.
* @returns True if the selection is inside a notice block.
*/
export function isInNotice(state: EditorState): boolean {
const { nodes } = state.schema;
return nodes.container_notice && isNodeActive(nodes.container_notice)(state);
}