add blockquote commands

This commit is contained in:
Philipp Kühn
2020-11-18 11:54:18 +01:00
parent 3f624845e8
commit 012beb286c
9 changed files with 63 additions and 9 deletions

View File

@@ -4,13 +4,13 @@ import { Command } from '../types'
import nodeIsActive from '../utils/nodeIsActive'
import getNodeType from '../utils/getNodeType'
export default (typeOrName: string | NodeType, attrs = {}): Command => ({ state, dispatch }) => {
export default (typeOrName: string | NodeType, attributes = {}): Command => ({ state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema)
const isActive = nodeIsActive(state, type, attrs)
const isActive = nodeIsActive(state, type, attributes)
if (isActive) {
return lift(state, dispatch)
}
return wrapIn(type, attrs)(state, dispatch)
return wrapIn(type, attributes)(state, dispatch)
}