refactoring
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { wrapIn, lift } from 'prosemirror-commands'
|
||||
import { NodeType } from 'prosemirror-model'
|
||||
import { Command } from '../types'
|
||||
import nodeIsActive from '../helpers/nodeIsActive'
|
||||
import isNodeActive from '../helpers/isNodeActive'
|
||||
import getNodeType from '../helpers/getNodeType'
|
||||
|
||||
/**
|
||||
@@ -9,7 +9,7 @@ import getNodeType from '../helpers/getNodeType'
|
||||
*/
|
||||
export const toggleWrap = (typeOrName: string | NodeType, attributes = {}): Command => ({ state, dispatch }) => {
|
||||
const type = getNodeType(typeOrName, state.schema)
|
||||
const isActive = nodeIsActive(state, type, attributes)
|
||||
const isActive = isNodeActive(state, type, attributes)
|
||||
|
||||
if (isActive) {
|
||||
return lift(state, dispatch)
|
||||
|
||||
Reference in New Issue
Block a user