replace extensions
This commit is contained in:
@@ -1,18 +1,37 @@
|
||||
import Extension from './Extension'
|
||||
import { MarkSpec } from 'prosemirror-model'
|
||||
import { MarkSpec, MarkType } from 'prosemirror-model'
|
||||
import Extension, { ExtensionCallback, ExtensionExtends } from './Extension'
|
||||
|
||||
export default abstract class Mark extends Extension {
|
||||
// export default abstract class Mark extends Extension {
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
}
|
||||
// constructor(options = {}) {
|
||||
// super(options)
|
||||
// }
|
||||
|
||||
public extensionType = 'mark'
|
||||
// public extensionType = 'mark'
|
||||
|
||||
abstract schema(): MarkSpec
|
||||
// abstract schema(): MarkSpec
|
||||
|
||||
get type() {
|
||||
return this.editor.schema.marks[this.name]
|
||||
}
|
||||
// get type() {
|
||||
// return this.editor.schema.marks[this.name]
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
export interface MarkCallback extends ExtensionCallback {
|
||||
// TODO: fix optional
|
||||
type?: MarkType
|
||||
}
|
||||
|
||||
export interface MarkExtends<Callback = MarkCallback> extends ExtensionExtends<Callback> {
|
||||
topMark: boolean
|
||||
schema: (params: Callback) => MarkSpec
|
||||
}
|
||||
|
||||
export default class Mark<Options = {}> extends Extension<Options, MarkExtends> {
|
||||
type = 'node'
|
||||
|
||||
public schema(value: MarkExtends['schema']) {
|
||||
this.storeConfig('schema', value, 'overwrite')
|
||||
return this
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user