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

33 lines
579 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,
}
2020-11-16 06:25:25 +08:00
const Dropcursor = Extension.create({
2020-12-02 16:44:46 +08:00
name: 'dropCursor',
2020-11-19 04:40:20 +08:00
defaultOptions: <DropcursorOptions>{
color: 'black',
width: 1,
class: null,
},
addProseMirrorPlugins() {
return [
2020-11-19 04:40:20 +08:00
dropCursor(this.options),
]
},
})
export default Dropcursor
declare module '@tiptap/core' {
interface AllExtensions {
Dropcursor: typeof Dropcursor,
}
}