rename
This commit is contained in:
@@ -2,7 +2,7 @@ import { Plugin } from 'prosemirror-state'
|
||||
import { Editor } from './Editor'
|
||||
import { GlobalAttributes } from './types'
|
||||
|
||||
export interface ExtensionSpec<Options = any, Commands = {}> {
|
||||
export interface ExtensionConfig<Options = any, Commands = {}> {
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ export interface ExtensionSpec<Options = any, Commands = {}> {
|
||||
}
|
||||
|
||||
export class Extension<Options = any, Commands = any> {
|
||||
config: Required<ExtensionSpec> = {
|
||||
config: Required<ExtensionConfig> = {
|
||||
name: 'extension',
|
||||
defaultOptions: {},
|
||||
addGlobalAttributes: () => [],
|
||||
@@ -77,7 +77,7 @@ export class Extension<Options = any, Commands = any> {
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: ExtensionSpec<Options, Commands>) {
|
||||
constructor(config: ExtensionConfig<Options, Commands>) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
@@ -86,13 +86,13 @@ export class Extension<Options = any, Commands = any> {
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O, C>(config: ExtensionSpec<O, C>) {
|
||||
static create<O, C>(config: ExtensionConfig<O, C>) {
|
||||
return new Extension<O, C>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options>) {
|
||||
return Extension
|
||||
.create<Options, Commands>(this.config as ExtensionSpec<Options, Commands>)
|
||||
.create<Options, Commands>(this.config as ExtensionConfig<Options, Commands>)
|
||||
.#configure({
|
||||
...this.config.defaultOptions,
|
||||
...options,
|
||||
@@ -108,10 +108,10 @@ export class Extension<Options = any, Commands = any> {
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<ExtensionSpec<ExtendedOptions, ExtendedCommands>>) {
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions, ExtendedCommands>>) {
|
||||
return new Extension<ExtendedOptions, ExtendedCommands>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as ExtensionSpec<ExtendedOptions, ExtendedCommands>)
|
||||
} as ExtensionConfig<ExtendedOptions, ExtendedCommands>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
MarkType,
|
||||
} from 'prosemirror-model'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { ExtensionSpec } from './Extension'
|
||||
import { ExtensionConfig } from './Extension'
|
||||
import { Attributes, Overwrite } from './types'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
export interface MarkExtensionSpec<Options = any, Commands = {}> extends Overwrite<ExtensionSpec<Options, Commands>, {
|
||||
export interface MarkConfig<Options = any, Commands = {}> extends Overwrite<ExtensionConfig<Options, Commands>, {
|
||||
/**
|
||||
* Inclusive
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ export interface MarkExtensionSpec<Options = any, Commands = {}> extends Overwri
|
||||
}> {}
|
||||
|
||||
export class Mark<Options = any, Commands = {}> {
|
||||
config: Required<MarkExtensionSpec> = {
|
||||
config: Required<MarkConfig> = {
|
||||
name: 'mark',
|
||||
defaultOptions: {},
|
||||
addGlobalAttributes: () => [],
|
||||
@@ -130,7 +130,7 @@ export class Mark<Options = any, Commands = {}> {
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: MarkExtensionSpec<Options, Commands>) {
|
||||
constructor(config: MarkConfig<Options, Commands>) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
@@ -139,13 +139,13 @@ export class Mark<Options = any, Commands = {}> {
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O, C>(config: MarkExtensionSpec<O, C>) {
|
||||
static create<O, C>(config: MarkConfig<O, C>) {
|
||||
return new Mark<O, C>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options>) {
|
||||
return Mark
|
||||
.create<Options, Commands>(this.config as MarkExtensionSpec<Options, Commands>)
|
||||
.create<Options, Commands>(this.config as MarkConfig<Options, Commands>)
|
||||
.#configure({
|
||||
...this.config.defaultOptions,
|
||||
...options,
|
||||
@@ -161,10 +161,10 @@ export class Mark<Options = any, Commands = {}> {
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<MarkExtensionSpec<ExtendedOptions, ExtendedCommands>>) {
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<MarkConfig<ExtendedOptions, ExtendedCommands>>) {
|
||||
return new Mark<ExtendedOptions, ExtendedCommands>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as MarkExtensionSpec<ExtendedOptions, ExtendedCommands>)
|
||||
} as MarkConfig<ExtendedOptions, ExtendedCommands>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
NodeType,
|
||||
} from 'prosemirror-model'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { ExtensionSpec } from './Extension'
|
||||
import { ExtensionConfig } from './Extension'
|
||||
import { Attributes, NodeViewRenderer, Overwrite } from './types'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
export interface NodeExtensionSpec<Options = any, Commands = {}> extends Overwrite<ExtensionSpec<Options, Commands>, {
|
||||
export interface NodeConfig<Options = any, Commands = {}> extends Overwrite<ExtensionConfig<Options, Commands>, {
|
||||
/**
|
||||
* TopNode
|
||||
*/
|
||||
@@ -154,7 +154,7 @@ export interface NodeExtensionSpec<Options = any, Commands = {}> extends Overwri
|
||||
}> {}
|
||||
|
||||
export class Node<Options = any, Commands = {}> {
|
||||
config: Required<NodeExtensionSpec> = {
|
||||
config: Required<NodeConfig> = {
|
||||
name: 'node',
|
||||
defaultOptions: {},
|
||||
addGlobalAttributes: () => [],
|
||||
@@ -182,7 +182,7 @@ export class Node<Options = any, Commands = {}> {
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: NodeExtensionSpec<Options, Commands>) {
|
||||
constructor(config: NodeConfig<Options, Commands>) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
@@ -191,13 +191,13 @@ export class Node<Options = any, Commands = {}> {
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O, C>(config: NodeExtensionSpec<O, C>) {
|
||||
static create<O, C>(config: NodeConfig<O, C>) {
|
||||
return new Node<O, C>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options>) {
|
||||
return Node
|
||||
.create<Options, Commands>(this.config as NodeExtensionSpec<Options, Commands>)
|
||||
.create<Options, Commands>(this.config as NodeConfig<Options, Commands>)
|
||||
.#configure({
|
||||
...this.config.defaultOptions,
|
||||
...options,
|
||||
@@ -213,10 +213,10 @@ export class Node<Options = any, Commands = {}> {
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<NodeExtensionSpec<ExtendedOptions, ExtendedCommands>>) {
|
||||
extend<ExtendedOptions = Options, ExtendedCommands = Commands>(extendedConfig: Partial<NodeConfig<ExtendedOptions, ExtendedCommands>>) {
|
||||
return new Node<ExtendedOptions, ExtendedCommands>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as NodeExtensionSpec<ExtendedOptions, ExtendedCommands>)
|
||||
} as NodeConfig<ExtendedOptions, ExtendedCommands>)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user