Skip to main content

extension-trailing-node

package @remirror/extension-trailing-node

class TrailingNodeExtension

Ensure that there's always a trailing paragraph at the end of the document.

Why? In some scenarios it is difficult to place a cursor after the last element. This ensures there's always space to select the position afterward.

Signature:

export declare class TrailingNodeExtension extends PlainExtension<TrailingNodeOptions> 

Extends: PlainExtension<TrailingNodeOptions>

(Some inherited members may not be shown because they are not represented in the documentation.)

property name

Signature:

get name(): "trailingNode";

method createExternalPlugins

Add the trailing node plugin to the editor.

Signature:

createExternalPlugins(): ProsemirrorPlugin[];

Returns:

ProsemirrorPlugin[]

method onSetOptions

Whenever the options are changed make sure to update the plugin with the new values and trigger a state update.

Signature:

protected onSetOptions(props: OnSetOptionsProps<TrailingNodeOptions>): void;

Parameters:

ParameterTypeDescription
propsOnSetOptionsProps<TrailingNodeOptions>

Returns:

void

interface TrailingNodeOptions

Signature:

export interface TrailingNodeOptions extends TrailingNodePluginOptions 

Extends: TrailingNodePluginOptions

property disableTags

By default this extension will set trailing nodes for all nodes except for the ones that have the tag Tags.LastNodeCompatible. Setting this to true means that the only nodes that will be ignored are those passed to the ignoredNodes array.

Signature:

disableTags?: boolean;

property ignoredNodes

The nodes for which this rule should not apply.

Signature:

ignoredNodes?: string[];

property nodeName

The node to create at the end of the document.

**Note**: the nodeName will always be added to the ignoredNodes lists to prevent an infinite loop.

Signature:

nodeName?: string;