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-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: {
|
2021-06-10 07:56:06 +08:00
|
|
|
color: 'currentcolor',
|
2020-11-19 04:40:20 +08:00
|
|
|
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
|
|
|
]
|
|
|
|
},
|
|
|
|
})
|