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

@@ -0,0 +1,16 @@
import { lift } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { Command } from '../types'
import nodeIsActive from '../utils/nodeIsActive'
import getNodeType from '../utils/getNodeType'
export default (typeOrName: string | NodeType, attributes = {}): Command => ({ state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema)
const isActive = nodeIsActive(state, type, attributes)
if (!isActive) {
return false
}
return lift(state, dispatch)
}