fix type for getAttributes

This commit is contained in:
Philipp Kühn
2021-07-26 15:36:12 +02:00
parent c315935bf9
commit 4636b1a1a5
2 changed files with 9 additions and 3 deletions

View File

@@ -4,7 +4,12 @@ import { Slice, Fragment, MarkType } from 'prosemirror-model'
export default function (
regexp: RegExp,
type: MarkType,
getAttributes?: Record<string, any> | ((match: RegExpExecArray) => Record<string, any>),
getAttributes?:
| Record<string, any>
| ((match: RegExpExecArray) => Record<string, any>)
| false
| null
,
): Plugin {
const handler = (fragment: Fragment, parent?: any) => {
const nodes: any[] = []
@@ -29,9 +34,9 @@ export default function (
const attrs = getAttributes instanceof Function
? getAttributes(match)
: getAttributes
if (!attrs) {
continue;
continue
}
// adding text before markdown to nodes