refactoring

This commit is contained in:
Philipp Kühn
2020-12-01 09:20:25 +01:00
parent bc39e922ca
commit fe9f74ebdf
5 changed files with 13 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import { EditorState } from 'prosemirror-state'
import { Node, NodeType } from 'prosemirror-model'
import objectIncludes from '../utilities/objectIncludes'
import getNodeType from './getNodeType'
import { AnyObject } from '../types'
export type NodeRange = {
node: Node,
@@ -12,7 +13,7 @@ export type NodeRange = {
export default function isNodeActive(
state: EditorState,
typeOrName: NodeType | string | null,
attributes = {},
attributes: AnyObject = {},
): boolean {
const { from, to, empty } = state.selection
const type = typeOrName