add toggleMark command

This commit is contained in:
Philipp Kühn
2020-04-22 14:06:15 +02:00
parent 0e18e67c93
commit 4e6404a404
7 changed files with 57 additions and 14 deletions

View File

@@ -0,0 +1,9 @@
import { MarkType, Schema } from 'prosemirror-model'
export default function getMarkType(nameOrType: string | MarkType, schema: Schema): MarkType {
if (typeof nameOrType === 'string') {
return schema.marks[nameOrType]
}
return nameOrType
}