tiptap/packages/extension-dropcursor/src/dropcursor.ts
Philipp Kühn 9afadeb7fe
feat!: Replace defaultOptions with addOptions (#2088)
* add new addOptions option

* replace defaultOptions with addOptions for all extensions

* replace defaultOptions with addOptions for all demos

* replace defaultOptions with addOptions in docs

* refactoring

* refactoring

* drop object support for addOptions

* fix optional options

* fix tests
2021-10-26 18:31:13 +02:00

27 lines
486 B
TypeScript

import { Extension } from '@tiptap/core'
import { dropCursor } from 'prosemirror-dropcursor'
export interface DropcursorOptions {
color: string | null,
width: number | null,
class: string | null,
}
export const Dropcursor = Extension.create<DropcursorOptions>({
name: 'dropCursor',
addOptions() {
return {
color: 'currentColor',
width: 1,
class: null,
}
},
addProseMirrorPlugins() {
return [
dropCursor(this.options),
]
},
})