add type to this context in extensions

This commit is contained in:
Philipp Kühn
2020-10-22 23:21:52 +02:00
parent 6746163dda
commit d8d33c7429
8 changed files with 258 additions and 64 deletions

View File

@@ -2,11 +2,11 @@ import { Schema } from 'prosemirror-model'
export default function getSchemaTypeByName(name: string, schema: Schema) {
if (schema.nodes[name]) {
return 'node'
return schema.nodes[name]
}
if (schema.marks[name]) {
return 'mark'
return schema.marks[name]
}
return null

View File

@@ -0,0 +1,13 @@
import { Schema } from 'prosemirror-model'
export default function getSchemaTypeNameByName(name: string, schema: Schema) {
if (schema.nodes[name]) {
return 'node'
}
if (schema.marks[name]) {
return 'mark'
}
return null
}