2020-11-16 06:25:25 +08:00
|
|
|
import { Extension } from '@tiptap/core'
|
2020-11-01 07:16:28 +08:00
|
|
|
import { dropCursor } from 'prosemirror-dropcursor'
|
|
|
|
|
2020-11-19 04:40:20 +08:00
|
|
|
type DropcursorOptions = {
|
|
|
|
color: string | null,
|
|
|
|
width: number | null,
|
|
|
|
class: string | null,
|
|
|
|
}
|
|
|
|
|
2020-11-16 06:25:25 +08:00
|
|
|
const Dropcursor = Extension.create({
|
2020-11-19 04:40:20 +08:00
|
|
|
defaultOptions: <DropcursorOptions>{
|
|
|
|
color: 'black',
|
|
|
|
width: 1,
|
|
|
|
class: null,
|
|
|
|
},
|
|
|
|
|
2020-11-01 07:16:28 +08:00
|
|
|
addProseMirrorPlugins() {
|
|
|
|
return [
|
2020-11-19 04:40:20 +08:00
|
|
|
dropCursor(this.options),
|
2020-11-01 07:16:28 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export default Dropcursor
|
|
|
|
|
2020-11-16 23:58:30 +08:00
|
|
|
declare module '@tiptap/core' {
|
|
|
|
interface AllExtensions {
|
|
|
|
Dropcursor: typeof Dropcursor,
|
2020-11-01 07:16:28 +08:00
|
|
|
}
|
|
|
|
}
|