mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-02 15:57:50 +08:00
9afadeb7fe
* 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
27 lines
486 B
TypeScript
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),
|
|
]
|
|
},
|
|
})
|