NodeConfig
@blockslides/core / NodeConfig
Interface: NodeConfig<Options, Storage>
Defined in: blockslides/packages/core/src/Node.ts:13
Extends
ExtendableConfig<Options,Storage,NodeConfig<Options,Storage>,NodeType>
Type Parameters
Options
Options = any
Storage
Storage = any
Properties
name
name:
string
Defined in: blockslides/packages/core/src/Extendable.ts:50
The extension name - this must be unique. It will be used to identify the extension.
Example
'myExtension'
Inherited from
priority?
optionalpriority:number
Defined in: blockslides/packages/core/src/Extendable.ts:58
The priority of your extension. The higher, the earlier it will be called and will take precedence over other extensions with a lower priority.
Default
100
Example
101
Inherited from
addOptions()?
optionaladdOptions: (this) =>Options
Defined in: blockslides/packages/core/src/Extendable.ts:60
Parameters
this
name
string
parent
(...args) => Options | undefined
Returns
Options
Inherited from
addStorage()?
optionaladdStorage: (this) =>Storage
Defined in: blockslides/packages/core/src/Extendable.ts:66
Parameters
this
name
string
options
Options
parent
(...args) => Storage | undefined
Returns
Storage
Inherited from
addGlobalAttributes()?
optionaladdGlobalAttributes: (this) =>GlobalAttributes
Defined in: blockslides/packages/core/src/Extendable.ts:72
Parameters
this
name
string
options
Options
storage
Storage
extensions
(Node<any, any> | Mark<any, any>)[]
parent
(...args) => GlobalAttributes | undefined
Returns
Inherited from
ExtendableConfig.addGlobalAttributes
addCommands()?
optionaladdCommands: (this) =>Partial<RawCommands>
Defined in: blockslides/packages/core/src/Extendable.ts:80
Parameters
this
name
string
options
Options
storage
Storage
editor
type
NodeType
parent
(...args) => ReturnType<Required<T>[P]> | undefined
Returns
Partial<RawCommands>
Inherited from
addKeyboardShortcuts()?
optionaladdKeyboardShortcuts: (this) =>object
Defined in: blockslides/packages/core/src/Extendable.ts:89
Parameters
this
name
string
options
Options
storage
Storage
editor
type
NodeType
parent
(...args) => object | undefined
Returns
object
Inherited from
ExtendableConfig.addKeyboardShortcuts
addInputRules()?
optionaladdInputRules: (this) =>InputRule[]
Defined in: blockslides/packages/core/src/Extendable.ts:100
Parameters
this
name
string
options
Options
storage
Storage
editor
type
NodeType
parent
(...args) => InputRule[] | undefined
Returns
Inherited from
ExtendableConfig.addInputRules
addPasteRules()?
optionaladdPasteRules: (this) =>PasteRule[]
Defined in: blockslides/packages/core/src/Extendable.ts:109
Parameters
this
name
string
options
Options
storage
Storage
editor
type
NodeType
parent
(...args) => PasteRule[] | undefined
Returns
Inherited from
ExtendableConfig.addPasteRules
addProseMirrorPlugins()?
optionaladdProseMirrorPlugins: (this) =>Plugin<any>[]
Defined in: blockslides/packages/core/src/Extendable.ts:118
Parameters
this
name
string
options
Options
storage
Storage
editor
type
NodeType
parent
(...args) => Plugin<any>[] | undefined
Returns
Plugin<any>[]
Inherited from
ExtendableConfig.addProseMirrorPlugins
addExtensions()?
optionaladdExtensions: (this) =>Extensions
Defined in: blockslides/packages/core/src/Extendable.ts:127
Parameters
this
name
string
options
Options
storage
Storage
parent
(...args) => Extensions | undefined
Returns
Inherited from
ExtendableConfig.addExtensions
markdownTokenName?
optionalmarkdownTokenName:string
Defined in: blockslides/packages/core/src/Extendable.ts:134
Inherited from
ExtendableConfig.markdownTokenName
parseMarkdown()?
optionalparseMarkdown: (token,helpers) =>MarkdownParseResult
Defined in: blockslides/packages/core/src/Extendable.ts:139
The parse function used by the markdown parser to convert markdown tokens to ProseMirror nodes.
Parameters
token
helpers
Returns
Inherited from
ExtendableConfig.parseMarkdown
renderMarkdown()?
optionalrenderMarkdown: (node,helpers,ctx) =>string
Defined in: blockslides/packages/core/src/Extendable.ts:147
The serializer function used by the markdown serializer to convert ProseMirror nodes to markdown tokens.
Parameters
node
helpers
ctx
Returns
string
Inherited from
ExtendableConfig.renderMarkdown
markdownTokenizer?
optionalmarkdownTokenizer:MarkdownTokenizer
Defined in: blockslides/packages/core/src/Extendable.ts:158
The markdown tokenizer responsible for turning a markdown string into tokens
Custom tokenizers are only needed when you want to parse non-standard markdown token.
Inherited from
ExtendableConfig.markdownTokenizer
markdownOptions?
optionalmarkdownOptions:object
Defined in: blockslides/packages/core/src/Extendable.ts:163
Optional markdown options for indentation
indentsContent?
optionalindentsContent:boolean
Defines if this markdown element should indent it's child elements
Inherited from
ExtendableConfig.markdownOptions
extendNodeSchema?
optionalextendNodeSchema: (this,extension) =>Record<string,any> |null
Defined in: blockslides/packages/core/src/Extendable.ts:180
This function extends the schema of the node.
Example
extendNodeSchema() {
return {
group: 'inline',
selectable: false,
}
}
Inherited from
ExtendableConfig.extendNodeSchema
extendMarkSchema?
optionalextendMarkSchema: (this,extension) =>Record<string,any> |null
Defined in: blockslides/packages/core/src/Extendable.ts:202
This function extends the schema of the mark.
Example
extendMarkSchema() {
return {
group: 'inline',
selectable: false,
}
}
Inherited from
ExtendableConfig.extendMarkSchema
onBeforeCreate?
optionalonBeforeCreate: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:217
The editor is not ready yet.
Inherited from
ExtendableConfig.onBeforeCreate
onCreate?
optionalonCreate: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:234
The editor is ready.
Inherited from
onUpdate?
optionalonUpdate: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:251
The content has changed.
Inherited from
onSelectionUpdate?
optionalonSelectionUpdate: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:268
The selection has changed.
Inherited from
ExtendableConfig.onSelectionUpdate
onTransaction?
optionalonTransaction: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:285
The editor state has changed.
Inherited from
ExtendableConfig.onTransaction
onFocus?
optionalonFocus: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:302
The editor is focused.
Inherited from
onBlur?
optionalonBlur: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:319
The editor isn’t focused anymore.
Inherited from
onDestroy?
optionalonDestroy: (this,event) =>void|null
Defined in: blockslides/packages/core/src/Extendable.ts:336
The editor is destroyed.
Inherited from
addNodeView?
optionaladdNodeView: (this) =>NodeViewRenderer|null
Defined in: blockslides/packages/core/src/Node.ts:23
Node View
topNode?
optionaltopNode:boolean
Defined in: blockslides/packages/core/src/Node.ts:39
Defines if this node should be a top level node (doc)
Default
false
Example
true
content?
optionalcontent:string| (this) =>string|undefined
Defined in: blockslides/packages/core/src/Node.ts:52
The content expression for this node, as described in the schema guide. When not given, the node does not allow any content.
You can read more about it on the Prosemirror documentation here
See
https://prosemirror.net/docs/guide/#schema.content_expressions
Default
undefined
Examples
content: 'block+'
content: 'headline paragraph block*'
marks?
optionalmarks:string| (this) =>string|undefined
Defined in: blockslides/packages/core/src/Node.ts:71
The marks that are allowed inside of this node. May be a
space-separated string referring to mark names or groups, "_"
to explicitly allow all marks, or "" to disallow marks. When
not given, nodes with inline content default to allowing all
marks, other nodes default to not allowing marks.
Example
marks: 'strong em'
group?
optionalgroup:string| (this) =>string|undefined
Defined in: blockslides/packages/core/src/Node.ts:93
The group or space-separated groups to which this node belongs, which can be referred to in the content expressions for the schema.
By default BlockSlides uses the groups 'block' and 'inline' for nodes. You can also use custom groups if you want to group specific nodes together and handle them in your schema.
Examples
group: 'block'
group: 'inline'
group: 'customBlock' // this uses a custom group
inline?
optionalinline:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:106
Should be set to true for inline nodes. (Implied for text nodes.)
atom?
optionalatom:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:123
Can be set to true to indicate that, though this isn't a leaf node, it doesn't have directly editable content and should be treated as a single unit in the view.
Example
atom: true
selectable?
optionalselectable:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:141
Controls whether nodes of this type can be selected as a node selection. Defaults to true for non-text nodes.
Default
true
Example
selectable: false
draggable?
optionaldraggable:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:158
Determines whether nodes of this type can be dragged without being selected. Defaults to false.
@default: false @example: draggable: true
code?
optionalcode:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:172
Can be used to indicate that this node contains code, which causes some commands to behave differently.
whitespace?
optionalwhitespace:"pre"|"normal"| (this) =>"pre"|"normal"|undefined
Defined in: blockslides/packages/core/src/Node.ts:193
Controls way whitespace in this a node is parsed. The default is
"normal", which causes the DOM parser to
collapse whitespace in normal mode, and normalize it (replacing
newlines and such with spaces) otherwise. "pre" causes the
parser to preserve spaces inside the node. When this option isn't
given, but code is true, whitespace
will default to "pre". Note that this option doesn't influence
the way the node is rendered—that should be handled by toDOM
and/or styling.
linebreakReplacement?
optionallinebreakReplacement:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:212
Allows a single node to be set as linebreak equivalent (e.g. hardBreak). When converting between block types that have whitespace set to "pre" and don't support the linebreak node (e.g. codeBlock) and other block types that do support the linebreak node (e.g. paragraphs) - this node will be used as the linebreak instead of stripping the newline.
See linebreakReplacement.
defining?
optionaldefining:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:232
When enabled, enables both
definingAsContext and
definingForContent.
Default
false
Example
isolating: true
isolating?
optionalisolating:boolean| (this) =>boolean|undefined
Defined in: blockslides/packages/core/src/Node.ts:248
When enabled (default is false), the sides of nodes of this type count as boundaries that regular editing operations, like backspacing or lifting, won't cross. An example of a node that should probably have this enabled is a table cell.
parseHTML()?
optionalparseHTML: (this) => readonlyTagParseRule[] |undefined
Defined in: blockslides/packages/core/src/Node.ts:268
Associates DOM parser information with this node, which can be
used by DOMParser.fromSchema to
automatically derive a parser. The node field in the rules is
implied (the name of this node will be filled in automatically).
If you supply your own parser, you do not need to also specify
parsing rules in your schema.
Parameters
this
name
string
options
Options
storage
Storage
parent
(...args) => readonly TagParseRule[] | undefined | undefined
editor?
Returns
readonly TagParseRule[] | undefined
Example
parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
renderHTML?
optionalrenderHTML: (this,props) =>DOMOutputSpec|null
Defined in: blockslides/packages/core/src/Node.ts:296
A description of a DOM structure. Can be either a string, which is
interpreted as a text node, a DOM node, which is interpreted as
itself, a {dom, contentDOM} object, or an array.
An array describes a DOM element. The first value in the array
should be a string—the name of the DOM element, optionally prefixed
by a namespace URL and a space. If the second element is plain
object, it is interpreted as a set of attributes for the element.
Any elements after that (including the 2nd if it's not an attribute
object) are interpreted as children of the DOM elements, and must
either be valid DOMOutputSpec values, or the number zero.
The number zero (pronounced “hole”) is used to indicate the place where a node's child nodes should be inserted. If it occurs in an output spec, it should be the only child element in its parent node.
Example
toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
renderText?
optionalrenderText: (this,props) =>string|null
Defined in: blockslides/packages/core/src/Node.ts:316
renders the node as text
Example
renderText: () => 'foo
addAttributes()?
optionaladdAttributes: (this) => { } |Attributes
Defined in: blockslides/packages/core/src/Node.ts:338
Add attributes to the node
Parameters
this
name
string
options
Options
storage
Storage
parent
(...args) => { } | Attributes | undefined
editor?
Returns
{ } | Attributes
Example
addAttributes: () => ({ class: 'foo' })