tiptap/packages/extension-dropcursor/src/dropcursor.ts

25 lines
464 B
TypeScript
Raw Normal View History

2020-11-16 06:25:25 +08:00
import { Extension } from '@tiptap/core'
import { dropCursor } from 'prosemirror-dropcursor'
2020-11-26 06:35:23 +08:00
export interface DropcursorOptions {
2020-11-19 04:40:20 +08:00
color: string | null,
width: number | null,
class: string | null,
}
2021-02-11 01:25:08 +08:00
export const Dropcursor = Extension.create<DropcursorOptions>({
2020-12-02 16:44:46 +08:00
name: 'dropCursor',
2021-02-11 01:25:08 +08:00
defaultOptions: {
color: 'currentcolor',
2020-11-19 04:40:20 +08:00
width: 1,
class: null,
},
addProseMirrorPlugins() {
return [
2020-11-19 04:40:20 +08:00
dropCursor(this.options),
]
},
})