refactoring
This commit is contained in:
@@ -1,76 +1,5 @@
|
||||
// import { NodeSpec, NodeType } from 'prosemirror-model'
|
||||
// import Extension, { ExtensionMethods } from './Extension'
|
||||
// import { Editor } from './Editor'
|
||||
|
||||
// export interface NodeProps<Options> {
|
||||
// name: string
|
||||
// editor: Editor
|
||||
// options: Options
|
||||
// type: NodeType
|
||||
// }
|
||||
|
||||
// export interface NodeMethods<Props, Options> extends ExtensionMethods<Props, Options> {
|
||||
// topNode: boolean
|
||||
// schema: (params: Omit<Props, 'type' | 'editor'>) => NodeSpec
|
||||
// }
|
||||
|
||||
// export default class Node<
|
||||
// Options = {},
|
||||
// Props = NodeProps<Options>,
|
||||
// Methods extends NodeMethods<Props, Options> = NodeMethods<Props, Options>,
|
||||
// > extends Extension<Options, Props, Methods> {
|
||||
// type = 'node'
|
||||
|
||||
// public topNode(value: Methods['topNode'] = true) {
|
||||
// this.storeConfig('topNode', value, 'overwrite')
|
||||
// return this
|
||||
// }
|
||||
|
||||
// public schema(value: Methods['schema']) {
|
||||
// this.storeConfig('schema', value, 'overwrite')
|
||||
// return this
|
||||
// }
|
||||
// }
|
||||
|
||||
// import { DOMOutputSpec, DOMOutputSpecArray } from 'prosemirror-model'
|
||||
// import Extension from './Extension'
|
||||
|
||||
// export interface INode {
|
||||
// type: string
|
||||
// topNode: boolean
|
||||
// group: string
|
||||
// content: string
|
||||
// createAttributes(): any
|
||||
// parseHTML(): any
|
||||
// renderHTML(props: number): DOMOutputSpec
|
||||
// }
|
||||
|
||||
// export default class Node<Options = {}> extends Extension<Options> implements INode {
|
||||
|
||||
// type = 'node'
|
||||
|
||||
// topNode = false
|
||||
|
||||
// group = ''
|
||||
|
||||
// content = ''
|
||||
|
||||
// createAttributes() {
|
||||
// return {}
|
||||
// }
|
||||
|
||||
// parseHTML() {
|
||||
// return []
|
||||
// }
|
||||
|
||||
// renderHTML() {
|
||||
// return null
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
import { DOMOutputSpec, NodeSpec, Node } from 'prosemirror-model'
|
||||
import { ExtensionSpec } from './Extension'
|
||||
import { ExtensionSpec, defaultExtension } from './Extension'
|
||||
import { Attributes } from './types'
|
||||
|
||||
export interface NodeExtensionSpec<Options = {}, Commands = {}> extends ExtensionSpec<Options, Commands> {
|
||||
@@ -96,9 +25,7 @@ export interface NodeExtensionSpec<Options = {}, Commands = {}> extends Extensio
|
||||
},
|
||||
props: {
|
||||
node: Node,
|
||||
attributes: {
|
||||
[key: string]: any,
|
||||
},
|
||||
attributes: { [key: string]: any },
|
||||
}
|
||||
) => DOMOutputSpec,
|
||||
createAttributes?: (
|
||||
@@ -116,9 +43,9 @@ export type NodeExtension = Required<Omit<NodeExtensionSpec, 'defaultOptions'> &
|
||||
}>
|
||||
|
||||
const defaultNode: NodeExtension = {
|
||||
...defaultExtension,
|
||||
type: 'node',
|
||||
name: 'node',
|
||||
options: {},
|
||||
topNode: false,
|
||||
content: null,
|
||||
marks: null,
|
||||
@@ -130,8 +57,6 @@ const defaultNode: NodeExtension = {
|
||||
code: null,
|
||||
defining: null,
|
||||
isolating: null,
|
||||
createGlobalAttributes: () => [],
|
||||
createCommands: () => ({}),
|
||||
parseHTML: () => null,
|
||||
renderHTML: () => null,
|
||||
createAttributes: () => ({}),
|
||||
|
||||
Reference in New Issue
Block a user