mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
add allowGapCursor option
This commit is contained in:
parent
b06b368621
commit
46501ee226
@ -1,6 +1,15 @@
|
||||
import { Extension } from '@tiptap/core'
|
||||
import { Extension, callOrReturn } from '@tiptap/core'
|
||||
import { gapCursor } from 'prosemirror-gapcursor'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface NodeConfig<Options> {
|
||||
/**
|
||||
* Allow gap cursor
|
||||
*/
|
||||
allowGapCursor?: boolean | ((this: { options: Options }) => boolean),
|
||||
}
|
||||
}
|
||||
|
||||
export const Gapcursor = Extension.create({
|
||||
name: 'gapCursor',
|
||||
|
||||
@ -9,4 +18,12 @@ export const Gapcursor = Extension.create({
|
||||
gapCursor(),
|
||||
]
|
||||
},
|
||||
|
||||
extendNodeSchema(extension) {
|
||||
const context = { options: extension.options }
|
||||
|
||||
return {
|
||||
allowGapCursor: callOrReturn(extension.config.allowGapCursor, context) ?? null,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user