diff --git a/packages/core/src/helpers/getMarkType.ts b/packages/core/src/helpers/getMarkType.ts index c65100b2..48bf08a2 100644 --- a/packages/core/src/helpers/getMarkType.ts +++ b/packages/core/src/helpers/getMarkType.ts @@ -2,6 +2,10 @@ import { MarkType, Schema } from 'prosemirror-model' export default function getMarkType(nameOrType: string | MarkType, schema: Schema): MarkType { if (typeof nameOrType === 'string') { + if (!schema.marks[nameOrType]) { + throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`) + } + return schema.marks[nameOrType] } diff --git a/packages/core/src/helpers/getNodeType.ts b/packages/core/src/helpers/getNodeType.ts index 58da4f70..27430105 100644 --- a/packages/core/src/helpers/getNodeType.ts +++ b/packages/core/src/helpers/getNodeType.ts @@ -2,6 +2,10 @@ import { NodeType, Schema } from 'prosemirror-model' export default function getNodeType(nameOrType: string | NodeType, schema: Schema): NodeType { if (typeof nameOrType === 'string') { + if (!schema.nodes[nameOrType]) { + throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`) + } + return schema.nodes[nameOrType] }