mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-25 18:27:49 +08:00
28 lines
805 B
TypeScript
28 lines
805 B
TypeScript
import { MarkSpec, MarkType } from 'prosemirror-model'
|
|
import Extension, { ExtensionCallback, ExtensionExtends } from './Extension'
|
|
import { Editor } from './Editor'
|
|
|
|
export interface MarkCallback<Options> {
|
|
name: string
|
|
editor: Editor
|
|
options: Options
|
|
type: MarkType
|
|
}
|
|
|
|
export interface MarkExtends<Callback, Options> extends ExtensionExtends<Callback, Options> {
|
|
topMark: boolean
|
|
schema: (params: Omit<Callback, 'type' | 'editor'>) => MarkSpec
|
|
}
|
|
|
|
export default class Mark<
|
|
Options = {},
|
|
Callback = MarkCallback<Options>,
|
|
Extends extends MarkExtends<Callback, Options> = MarkExtends<Callback, Options>
|
|
> extends Extension<Options, Callback, Extends> {
|
|
type = 'mark'
|
|
|
|
public schema(value: Extends['schema']) {
|
|
this.storeConfig('schema', value, 'overwrite')
|
|
return this
|
|
}
|
|
} |