mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-07 09:25:29 +08:00
fix type for getAttributes
This commit is contained in:
parent
c315935bf9
commit
4636b1a1a5
@ -35,6 +35,7 @@ module.exports = {
|
|||||||
'airbnb-base',
|
'airbnb-base',
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
|
'no-continue': 'off',
|
||||||
'no-alert': 'off',
|
'no-alert': 'off',
|
||||||
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
||||||
semi: ['error', 'never'],
|
semi: ['error', 'never'],
|
||||||
|
@ -4,7 +4,12 @@ import { Slice, Fragment, MarkType } from 'prosemirror-model'
|
|||||||
export default function (
|
export default function (
|
||||||
regexp: RegExp,
|
regexp: RegExp,
|
||||||
type: MarkType,
|
type: MarkType,
|
||||||
getAttributes?: Record<string, any> | ((match: RegExpExecArray) => Record<string, any>),
|
getAttributes?:
|
||||||
|
| Record<string, any>
|
||||||
|
| ((match: RegExpExecArray) => Record<string, any>)
|
||||||
|
| false
|
||||||
|
| null
|
||||||
|
,
|
||||||
): Plugin {
|
): Plugin {
|
||||||
const handler = (fragment: Fragment, parent?: any) => {
|
const handler = (fragment: Fragment, parent?: any) => {
|
||||||
const nodes: any[] = []
|
const nodes: any[] = []
|
||||||
@ -29,9 +34,9 @@ export default function (
|
|||||||
const attrs = getAttributes instanceof Function
|
const attrs = getAttributes instanceof Function
|
||||||
? getAttributes(match)
|
? getAttributes(match)
|
||||||
: getAttributes
|
: getAttributes
|
||||||
|
|
||||||
if (!attrs) {
|
if (!attrs) {
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// adding text before markdown to nodes
|
// adding text before markdown to nodes
|
||||||
|
Loading…
Reference in New Issue
Block a user