Interface: DirectiveDescriptor<T>
Implement this interface to create a custom editor for markdown directives.
Pass the object in the directivesPlugin
parameters.
Type parameters
Type parameter | Value |
---|---|
T extends Directives | Directives |
Methods
testNode()
testNode(
node
):boolean
Whether the descriptor's Editor should be used for the given node.
Parameters
Parameter | Type | Description |
---|---|---|
node | Directives | The directive mdast node. You can code your logic against the node's name, type, attributes, children, etc. |
Returns
boolean
Properties
Property | Type | Description |
---|---|---|
Editor | ComponentType <DirectiveEditorProps <T >> | The React component to be used as an Editor. See DirectiveEditorProps for the props passed to the component. |
attributes | string [] | The attributes that the directive has. This can be used when building the UI for the user to configure a directive. The GenericDirectiveEditor uses those to display a property form. |
hasChildren | boolean | Whether or not the directive has inner markdown content as children. Used by the GenericDirectiveEditor to determine whether to show the inner markdown editor. |
name | string | The name of the descriptor - use this if you're building UI for the user to select a directive. |
type? | "containerDirective" | "leafDirective" | "textDirective" | The type of the supported directive. Can be one of: 'leafDirective' | 'containerDirective' | 'textDirective'. |