DirectiveDescriptor interface

Implement this interface to create a custom editor for markdown directives. Pass the object in the directivesPlugin parameters.

Signature:

export interface DirectiveDescriptor<T extends Directive = Directive> 

Properties

PropertyModifiersTypeDescription
attributesstring[]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.
EditorReact.ComponentType<DirectiveEditorProps<T>>The React component to be used as an Editor. See DirectiveEditorProps for the props passed to the component.
hasChildrenbooleanWhether or not the directive has inner markdown content as children. Used by the GenericDirectiveEditor to determine whether to show the inner markdown editor.
namestringThe name of the descriptor - use this if you're building UI for the user to select a directive.
type?'leafDirective' | 'containerDirective' | 'textDirective'(Optional) The type of the supported directive. Can be one of: 'leafDirective' | 'containerDirective' | 'textDirective'.

Methods

MethodDescription
testNode(node)Whether the descriptor's Editor should be used for the given node.