restructure commands

This commit is contained in:
Philipp Kühn
2020-11-18 16:43:27 +01:00
parent 03f009d5f0
commit 3cd6c55279
37 changed files with 214 additions and 231 deletions

View File

@@ -2,7 +2,10 @@ import { NodeType } from 'prosemirror-model'
import getNodeType from '../utils/getNodeType'
import { Command } from '../types'
export default (typeOrName: string | NodeType, attributes: {}): Command => ({ tr, state, dispatch }) => {
/**
* Update attributes of a node.
*/
export const updateNodeAttributes = (typeOrName: string | NodeType, attributes: {}): Command => ({ tr, state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema)
const { selection } = tr
const { from, to } = selection