Skip to main content

core-utils

package @remirror/core-utils

function applyClonedTransaction()

Apply the steps of a cloned transaction to the original transaction tr.

Signature:

export declare function applyClonedTransaction(props: ApplyClonedTransactionProps): void;

Parameters:

ParameterTypeDescription
propsApplyClonedTransactionProps

Returns:

void

function areSchemasCompatible()

Check that the nodes and marks present on schemaA are also present on schemaB.

Signature:

export declare function areSchemasCompatible(schemaA: EditorSchema, schemaB: EditorSchema): boolean;

Parameters:

ParameterTypeDescription
schemaAEditorSchema
schemaBEditorSchema

Returns:

boolean

function areStatesEqual()

Check if two states are equal.

Signature:

export declare function areStatesEqual(stateA: EditorState, stateB: EditorState, options?: IsStateEqualOptions): boolean;

Parameters:

ParameterTypeDescription
stateAEditorState
stateBEditorState
optionsIsStateEqualOptions(Optional)

Returns:

boolean

function atDocEnd()

Checks whether the cursor is at the end of the state.doc

Signature:

export declare function atDocEnd(state: EditorState): boolean;

Parameters:

ParameterTypeDescription
stateEditorStatethe editor state

Returns:

boolean

function atDocStart()

Checks whether the cursor is at the beginning of the state.doc

Signature:

export declare function atDocStart(state: EditorState): boolean;

Parameters:

ParameterTypeDescription
stateEditorStatethe editor state

Returns:

boolean

function canInsertNode()

Check if the specified type (NodeType) can be inserted at the current selection point.

Signature:

export declare function canInsertNode(state: EditorState, type: NodeType): boolean;

Parameters:

ParameterTypeDescription
stateEditorStatethe editor state
typeNodeTypethe node type

Returns:

boolean

function chainKeyBindingCommands()

Chains together keybindings, allowing for the same key binding to be used across multiple extensions without overriding behavior.

Signature:

export declare function chainKeyBindingCommands(...commands: KeyBindingCommandFunction[]): KeyBindingCommandFunction;

Parameters:

ParameterTypeDescription
commandsKeyBindingCommandFunction[]

Returns:

KeyBindingCommandFunction

Remarks:

When next is called it hands over full control of the keybindings to the function that invokes it.

function cloneTransaction()

Creates a new transaction object from a given transaction. This is useful when applying changes to a transaction, that you may want to rollback.

function() applyUpdateIfValid(state: EditorState) {
const tr = cloneTransaction(state.tr);

tr.insertText('hello');

if (!checkValid(tr)) {
return;
}

applyClonedTransaction({ clone: tr, tr: state.tr });
}

The above example applies a transaction to the cloned transaction then checks to see if the changes are still valid and if they are applies the mutative changes to the original state transaction.

Signature:

export declare function cloneTransaction(tr: Transaction): Transaction;

Parameters:

ParameterTypeDescription
trTransactionthe prosemirror transaction

Returns:

Transaction

function composeTransactionSteps()

Returns a new transaction by combining all steps of the passed transactions onto the previous state

Signature:

export declare function composeTransactionSteps(transactions: readonly Transaction[], oldState: EditorState): Transaction;

Parameters:

ParameterTypeDescription
transactionsreadonly Transaction[]
oldStateEditorState

Returns:

Transaction

function containsAttributes()

Determines if a Node or Mark contains the given attributes in its attributes set

Signature:

export declare function containsAttributes(nodeOrMark: ProsemirrorNode | Mark, attrs: ProsemirrorAttributes): boolean;

Parameters:

ParameterTypeDescription
nodeOrMarkProsemirrorNode | MarkThe Node or Mark to check
attrsProsemirrorAttributesThe set of attributes it must contain

Returns:

boolean

function containsNodesOfType()

Returns true if a given node contains nodes of a given nodeType.

Signature:

export declare function containsNodesOfType(props: ContainsProps): boolean;

Parameters:

ParameterTypeDescription
propsContainsProps

Returns:

boolean

Remarks:

if (containsNodesOfType({ node: state.doc, type: schema.nodes.listItem })) {
log('contained')
}

function convertPixelsToDomUnit()

Convert the received font size to a valid unit

Signature:

export declare function convertPixelsToDomUnit(size: string, to: DomSizeUnit, element?: Element | null): number;

Parameters:

ParameterTypeDescription
sizestring
toDomSizeUnit
elementElement | null(Optional)

Returns:

number

function createDocumentNode()

Creates a document node from the passed in content and schema.

This supports a primitive form of error handling. When an error occurs, the onError handler will be called along with the error produced by the Schema and it is up to you as a developer to decide how to transform the invalid content into valid content.

Please note that the onError is only called when the content is a JSON object. It is not called for a string, the ProsemirrorNode or the EditorState. The reason for this is that the string requires a stringHandler which is defined by the developer and transforms the content. That is the point that error's should be handled. The editor state and the ProsemirrorNode are similar. They need to be created by the developer and as a result, the errors should be handled at the point of creation rather than when the document is being applied to the editor.

Signature:

export declare function createDocumentNode(props: CreateDocumentNodeProps): ProsemirrorNode;

Parameters:

ParameterTypeDescription
propsCreateDocumentNodeProps

Returns:

ProsemirrorNode

function endPositionOfParent()

Get the end position of the parent of the current resolve position

Signature:

export declare function endPositionOfParent($pos: ResolvedPos): number;

Parameters:

ParameterTypeDescription
$posResolvedPosthe resolved ProseMirror position

Returns:

number

function extractPixelSize()

Extract the pixel value from a dimension string or CSS function.

Supports the CSS functions min, max and clamp even when nested.

Does not support percentage units or the calc function.

Adapted from https://github.com/PacoteJS/pacote/blob/20cb1e3a999ed47a8d52b03b750290cf36b8e270/packages/pixels/src/index.ts

Signature:

export declare function extractPixelSize(size: string, element?: Element | null): number;

Parameters:

ParameterTypeDescription
sizestring
elementElement | null(Optional)

Returns:

number

function findChildren()

Iterates over descendants of a given node, returning child nodes predicate returns truthy for.

Signature:

export declare function findChildren(props: FindChildrenProps): NodeWithPosition[];

Parameters:

ParameterTypeDescription
propsFindChildrenProps

Returns:

NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const textNodes = findChildren({
node: state.doc,
predicate: child => child.isText,
descend: false
});

function findChildrenByAttribute()

Iterates over descendants of a given node, returning child nodes predicate returns truthy for.

Signature:

export declare function findChildrenByAttribute(props: FindChildrenByAttrProps): NodeWithPosition[];

Parameters:

ParameterTypeDescription
propsFindChildrenByAttrProps

Returns:

NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

The following will match any node with an id of any value (as long as the attribute exists) and a colspan of 2.

const mergedCells = findChildrenByAttribute({
node: table,
attrs: { colspan: 2, id: (_, exists) => exists }
});

function findChildrenByMark()

Iterates over descendants of a given node, returning child nodes that have a mark of a given markType.

Signature:

export declare function findChildrenByMark(paramter: FindChildrenByMarkProps): NodeWithPosition[];

Parameters:

ParameterTypeDescription
paramterFindChildrenByMarkProps

Returns:

NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const nodes = findChildrenByMark({ node: state.doc, type: schema.marks.strong });

function findChildrenByNode()

Iterates over descendants of a given node, returning child nodes of a given nodeType.

Signature:

export declare function findChildrenByNode(props: FindChildrenByNodeProps): NodeWithPosition[];

Parameters:

ParameterTypeDescription
propsFindChildrenByNodeProps

Returns:

NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const cells = findChildrenByNode({ node: state.doc, type: state.schema.nodes.tableCell });

function findElementAtPosition()

Returns DOM reference of a node at a given position.

Signature:

export declare function findElementAtPosition(position: number, view: EditorView): HTMLElement;

Parameters:

ParameterTypeDescription
positionnumberthe prosemirror position
viewEditorViewthe editor view

Returns:

HTMLElement

Remarks:

If the node type is of type TEXT_NODE it will return the reference of the parent node.

A simple use case

const element = findElementAtPosition($from.pos, view);

function findNodeAtPosition()

Finds the node at the resolved position.

Signature:

export declare function findNodeAtPosition($pos: ResolvedPos): FindProsemirrorNodeResult;

Parameters:

ParameterTypeDescription
$posResolvedPosthe resolve position in the document

Returns:

FindProsemirrorNodeResult

function findNodeAtSelection()

Finds the node at the passed selection.

Signature:

export declare function findNodeAtSelection(selection: Selection): FindProsemirrorNodeResult;

Parameters:

ParameterTypeDescription
selectionSelection

Returns:

FindProsemirrorNodeResult

function findParentNode()

Iterates over parent nodes, returning the closest node and its start position that the predicate returns truthy for. start points to the start position of the node, pos points directly before the node.

const predicate = node => node.type === schema.nodes.blockquote;
const parent = findParentNode({ predicate, selection });

Signature:

export declare function findParentNode(props: FindParentNodeProps): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
propsFindParentNodeProps

Returns:

FindProsemirrorNodeResult | undefined

function findParentNodeOfType()

Iterates over parent nodes, returning closest node of a given nodeType. start points to the start position of the node, pos points directly before the node.

```ts const parent = findParentNodeOfType({types: schema.nodes.paragraph, selection}); ```

Signature:

export declare function findParentNodeOfType(props: FindParentNodeOfTypeProps): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
propsFindParentNodeOfTypeProps

Returns:

FindProsemirrorNodeResult | undefined

function findPositionOfNodeAfter()

Warning: This API is now obsolete.

This util is hard to use and not that useful

Returns the position of the node after the current position, selection or state.

const pos = findPositionOfNodeBefore(tr.selection);

Signature:

export declare function findPositionOfNodeAfter(value: Selection | ResolvedPos | EditorState): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
valueSelection | ResolvedPos | EditorState

Returns:

FindProsemirrorNodeResult | undefined

function findPositionOfNodeBefore()

Warning: This API is now obsolete.

This util is hard to use and not that useful

Returns position of the previous node.

const pos = findPositionOfNodeBefore(tr.selection);

Signature:

export declare function findPositionOfNodeBefore(value: Selection | ResolvedPos | EditorState | Transaction): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
valueSelection | ResolvedPos | EditorState | Transaction

Returns:

FindProsemirrorNodeResult | undefined

function findSelectedNodeOfType()

Returns a node of a given nodeType if it is selected. start points to the start position of the node, pos points directly before the node.

const { extension, inlineExtension, bodiedExtension } = schema.nodes;

const selectedNode = findSelectedNodeOfType({
types: [extension, inlineExtension, bodiedExtension],
selection,
});

Signature:

export declare function findSelectedNodeOfType(props: FindSelectedNodeOfTypeProps): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
propsFindSelectedNodeOfTypeProps

Returns:

FindProsemirrorNodeResult | undefined

function getActiveNode()

Get node of a provided type with the provided attributes if it exists as a parent. Returns positional data for the node that was found.

Signature:

export declare function getActiveNode(props: GetActiveAttrsProps): FindProsemirrorNodeResult | undefined;

Parameters:

ParameterTypeDescription
propsGetActiveAttrsProps

Returns:

FindProsemirrorNodeResult | undefined

function getChangedNodeRanges()

Get all the changed node ranges for a provided transaction.

Signature:

export declare function getChangedNodeRanges(tr: Transaction, StepTypes?: Array<AnyConstructor<Step>>): NodeRange[];

Parameters:

ParameterTypeDescription
trTransactionthe transaction received with updates applied.
StepTypesArray<AnyConstructor<Step>>(Optional) the valid Step Constructors. Set to an empty array to accept all Steps.

Returns:

NodeRange[]

function getChangedNodes()

Get all the changed nodes from the provided transaction.

The following example will give us all the text nodes in the provided transaction.

import { getChangedNodes } from 'remirror/core';

const changedTextNodes = getChangeNodes(tr, { descend: true, predicate: (node) => node.isText });

Signature:

export declare function getChangedNodes(tr: Transaction, options?: GetChangedNodesOptions): NodeWithPosition[];

Parameters:

ParameterTypeDescription
trTransaction
optionsGetChangedNodesOptions(Optional)

Returns:

NodeWithPosition[]

function getChangedRanges()

Get all the ranges of changes for the provided transaction.

This can be used to gather specific parts of the document which require decorations to be recalculated or where nodes should be updated.

This is adapted from the answer [here](https://discuss.prosemirror.net/t/find-new-node-instances-and-track-them/96/7)

Signature:

export declare function getChangedRanges(tr: Transaction, StepTypes?: Array<AnyConstructor<Step>>): ChangedRange[];

Parameters:

ParameterTypeDescription
trTransactionthe transaction received with updates applied.
StepTypesArray<AnyConstructor<Step>>(Optional) the valid Step Constructors. Set to an empty array to accept all Steps.

Returns:

ChangedRange[]

function getCursor()

Retrieve the current position of the cursor

Signature:

export declare function getCursor(selection: Selection): ResolvedPos | null | undefined;

Parameters:

ParameterTypeDescription
selectionSelectionthe editor selection

Returns:

ResolvedPos | null | undefined

a resolved position only when the selection is a text selection

function getDefaultBlockNode()

Get the default block node from the schema.

Signature:

export declare function getDefaultBlockNode(schema: EditorSchema): NodeType;

Parameters:

ParameterTypeDescription
schemaEditorSchema

Returns:

NodeType

function getDefaultDocNode()

Get the default doc node for a given schema.

Signature:

export declare function getDefaultDocNode(schema: EditorSchema): ProsemirrorNode | undefined;

Parameters:

ParameterTypeDescription
schemaEditorSchema

Returns:

ProsemirrorNode | undefined

function getDocRange()

Get the full range of the selectable content in the ProseMirror doc.

Signature:

export declare function getDocRange(doc: ProsemirrorNode): FromToProps;

Parameters:

ParameterTypeDescription
docProsemirrorNode

Returns:

FromToProps

function getFontSize()

Signature:

export declare function getFontSize(element?: Element | null): string;

Parameters:

ParameterTypeDescription
elementElement | null(Optional)

Returns:

string

function getInvalidContent()

Get the invalid parameter which is passed to the onError handler.

Signature:

export declare function getInvalidContent<Extra extends object>({ json, schema, ...extra }: GetInvalidContentProps<Extra>): GetInvalidContentReturn<Extra>;

Parameters:

ParameterTypeDescription
{ json, schema, ...extra }GetInvalidContentProps<Extra>

Returns:

GetInvalidContentReturn<Extra>

function getMarkAttributes()

Retrieve the attributes for a mark.

Signature:

export declare function getMarkAttributes(trState: EditorState | Transaction, type: MarkType): ProsemirrorAttributes | false;

Parameters:

ParameterTypeDescription
trStateEditorState | Transactionthe editor state or a transaction
typeMarkTypethe mark type

Returns:

ProsemirrorAttributes | false

function getMarkRange()

Retrieve the start and end position of a mark. The $pos value should be calculated via tr.doc.resolve(number).

Signature:

export declare function getMarkRange($pos: ResolvedPos, type: string | MarkType, $end?: ResolvedPos): GetMarkRange | undefined;

Parameters:

ParameterTypeDescription
$posResolvedPosthe resolved ProseMirror position
typestring | MarkTypethe mark type
$endResolvedPos

(Optional) the end position to search until. When this is provided the mark will be checked for all point up until the $end. The first mark within the range will be returned.

To find all marks within a selection use [[getMarkRanges]].

Returns:

GetMarkRange | undefined

Remarks:

function getMarkRanges()

Get all the ranges which contain marks for the provided selection.

Signature:

export declare function getMarkRanges(selection: Selection, type: string | MarkType): GetMarkRange[];

Parameters:

ParameterTypeDescription
selectionSelection
typestring | MarkType

Returns:

GetMarkRange[]

function getMarkType()

Get the mark type from a potential string value.

Signature:

export declare function getMarkType(type: string | MarkType, schema: EditorSchema): MarkType;

Parameters:

ParameterTypeDescription
typestring | MarkType
schemaEditorSchema

Returns:

MarkType

function getMatchString()

Get matching string from a list or single value

Signature:

export declare function getMatchString(match: string | string[], index?: number): string;

Parameters:

ParameterTypeDescription
matchstring | string[]the match(es)
indexnumber(Optional) the zero-index point from which to start

Returns:

string

Remarks:

Get attrs can be called with a direct match string or array of string matches. This method should be used to retrieve the required string.

The index of the matched array used defaults to 0 but can be updated via the second parameter.

function getNodeType()

Get the node type from a potential string value.

Signature:

export declare function getNodeType(type: string | NodeType, schema: EditorSchema): NodeType;

Parameters:

ParameterTypeDescription
typestring | NodeType
schemaEditorSchema

Returns:

NodeType

function getRemirrorJSON()

A wrapper around state.doc.toJSON which returns the state as a RemirrorJSON object.

Signature:

export declare function getRemirrorJSON(content: EditorState | ProsemirrorNode): RemirrorJSON;

Parameters:

ParameterTypeDescription
contentEditorState | ProsemirrorNode

Returns:

RemirrorJSON

function getSelectedGroup()

Takes an empty selection and expands it out to the nearest group not matching the excluded characters.

Signature:

export declare function getSelectedGroup(state: EditorState | Transaction, exclude: RegExp): GetSelectedGroup | undefined;

Parameters:

ParameterTypeDescription
stateEditorState | Transactionthe editor state or a transaction
excludeRegExpthe regex pattern to exclude

Returns:

GetSelectedGroup | undefined

false if not a text selection or if no expansion available

Remarks:

Can be used to find the nearest selected word. See getSelectedWord()

function getSelectedWord()

Retrieves the nearest space separated word from the current selection.

Signature:

export declare function getSelectedWord(state: EditorState | Transaction): GetSelectedGroup | undefined;

Parameters:

ParameterTypeDescription
stateEditorState | Transactionthe editor state or transaction.

Returns:

GetSelectedGroup | undefined

Remarks:

This always expands outward so that given: The tw<start>o words<end> The selection would become The <start>two words<end>

In other words it expands until it meets an invalid character.

function getShortcutSymbols()

Convert a keyboard shortcut into symbols which and keys.

Signature:

export declare function getShortcutSymbols(shortcut: string): KeyboardSymbol[];

Parameters:

ParameterTypeDescription
shortcutstring

Returns:

KeyboardSymbol[]

function getStyle()

Get the styles for a given property of an element.

Signature:

export declare function getStyle(element: HTMLElement, property: KebabCase<StringKey<CSSStyleDeclaration>>): string;

Parameters:

ParameterTypeDescription
elementHTMLElement
propertyKebabCase<StringKey<CSSStyleDeclaration>>

Returns:

string

function getTextContentFromSlice()

Retrieves the text content from a slice

Signature:

export declare function getTextContentFromSlice(slice: Slice): string;

Parameters:

ParameterTypeDescription
sliceSlicethe prosemirror slice

Returns:

string

Remarks:

A utility that's useful for pulling text content from a slice which is usually created via selection.content()

function getTextSelection()

Get the nearest valid selection to the provided selection parameter.

Signature:

export declare function getTextSelection(selection: PrimitiveSelection, doc: ProsemirrorNode): Selection;

Parameters:

ParameterTypeDescription
selectionPrimitiveSelection
docProsemirrorNode

Returns:

Selection

function hasTransactionChanged()

Check to see if a transaction has changed either the document or the current selection.

Signature:

export declare function hasTransactionChanged(tr: Transaction): boolean;

Parameters:

ParameterTypeDescription
trTransactionthe transaction to check

Returns:

boolean

function htmlToProsemirrorNode()

Convert a HTML string into a ProseMirror node. This can be used for the stringHandler property in your editor when you want to support html.

import { htmlToProsemirrorNode } from 'remirror';
import { Remirror, useManager } from '@remirror/react';

const Editor = () => {
const manager = useManager([]);

return (
<Remirror
stringHandler={htmlToProsemirrorNode}
initialContent='<p>A wise person once told me to relax</p>'
>
<div />
</Remirror>
);
}

Signature:

export declare function htmlToProsemirrorNode(props: FragmentStringHandlerOptions): Fragment;

Parameters:

ParameterTypeDescription
propsFragmentStringHandlerOptions

Returns:

Fragment

function htmlToProsemirrorNode()

Signature:

export declare function htmlToProsemirrorNode(props: NodeStringHandlerOptions): ProsemirrorNode;

Parameters:

ParameterTypeDescription
propsNodeStringHandlerOptions

Returns:

ProsemirrorNode

function isAllSelection()

Predicate checking whether the selection is an AllSelection.

Signature:

export declare function isAllSelection(value: unknown): value is AllSelection;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is AllSelection

function isChrome()

Taken from https://stackoverflow.com/a/4900484

Check that the browser is chrome. Supports passing a minimum version to check that it is a greater than or equal to this version.

Signature:

export declare function isChrome(minVersion?: number): boolean;

Parameters:

ParameterTypeDescription
minVersionnumber(Optional)

Returns:

boolean

function isDefaultBlockNode()

Check if the provided node is a default block node.

Signature:

export declare function isDefaultBlockNode(node: ProsemirrorNode): boolean;

Parameters:

ParameterTypeDescription
nodeProsemirrorNode

Returns:

boolean

function isDefaultDocNode()

Check whether the provided doc node has the same value as the default empty node for the document. Basically checks that the document is untouched.

This is useful for extensions like the placeholder which only should be shown when the document matches the default empty state.

Signature:

export declare function isDefaultDocNode(doc: ProsemirrorNode, options?: DefaultDocNodeOptions): boolean;

Parameters:

ParameterTypeDescription
docProsemirrorNode
optionsDefaultDocNodeOptions(Optional)

Returns:

boolean

function isDocNode()

Checks whether a Prosemirror node is the top level doc node

Signature:

export declare function isDocNode(node: ProsemirrorNode | null | undefined, schema?: EditorSchema): node is ProsemirrorNode;

Parameters:

ParameterTypeDescription
nodeProsemirrorNode | null | undefinedthe prosemirror node
schemaEditorSchema(Optional) the prosemirror schema to check against

Returns:

node is ProsemirrorNode

function isDocNodeEmpty()

Checks if a node looks like an empty document.

Signature:

export declare function isDocNodeEmpty(node: ProsemirrorNode): boolean;

Parameters:

ParameterTypeDescription
nodeProsemirrorNodethe prosemirror node

Returns:

boolean

function isDomNode()

Checks whether the passed value is a valid dom node

Signature:

export declare function isDomNode(domNode: unknown): domNode is Node;

Parameters:

ParameterTypeDescription
domNodeunknownthe dom node

Returns:

domNode is Node

function isEditorSchema()

Checks to see if the passed value is an instance of the editor schema

Signature:

export declare function isEditorSchema(value: unknown): value is EditorSchema;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is EditorSchema

function isEditorState()

Checks to see if the passed value is a Prosemirror Editor State

Signature:

export declare function isEditorState(value: unknown): value is PMEditorState;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is PMEditorState

function isElementDomNode()

Checks for an element node like <p> or <div>.

Signature:

export declare function isElementDomNode(domNode: unknown): domNode is HTMLElement;

Parameters:

ParameterTypeDescription
domNodeunknownthe dom node

Returns:

domNode is HTMLElement

function isEmptyBlockNode()

Checks if the current node is a block node and empty.

Signature:

export declare function isEmptyBlockNode(node: ProsemirrorNode | null | undefined): boolean;

Parameters:

ParameterTypeDescription
nodeProsemirrorNode | null | undefinedthe prosemirror node

Returns:

boolean

function isEndOfTextBlock()

Checks that the selection is an empty text selection at the end of its parent node.

Signature:

export declare function isEndOfTextBlock(selection: Selection): selection is TextSelection;

Parameters:

ParameterTypeDescription
selectionSelection

Returns:

selection is TextSelection

function isMarkActive()

Checks that a mark is active within the selected region, or the current selection point is within a region with the mark active. Used by extensions to implement their active methods.

Signature:

export declare function isMarkActive(props: IsMarkActiveProps): boolean;

Parameters:

ParameterTypeDescription
propsIsMarkActivePropssee [[IsMarkActiveProps]] for options

Returns:

boolean

function isMarkType()

Check to see if the passed value is a MarkType.

Signature:

export declare function isMarkType(value: unknown): value is MarkType;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is MarkType

function isNodeActive()

Checks whether the node type passed in is active within the region. Used by extensions to implement the active method.

To ignore attrs just leave the attrs object empty or undefined.

Signature:

export declare function isNodeActive(props: GetActiveAttrsProps): boolean;

Parameters:

ParameterTypeDescription
propsGetActiveAttrsPropssee [[GetActiveAttrsProps]]

Returns:

boolean

function isNodeOfType()

Checks if the type a given node has a given nodeType.

Signature:

export declare function isNodeOfType(props: NodeEqualsTypeProps): boolean;

Parameters:

ParameterTypeDescription
propsNodeEqualsTypeProps

Returns:

boolean

function isNodeSelection()

Predicate checking whether the selection is a NodeSelection

Signature:

export declare function isNodeSelection(value: unknown): value is NodeSelection;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is NodeSelection

function isNodeType()

Check to see if the passed value is a NodeType.

Signature:

export declare function isNodeType(value: unknown): value is NodeType;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is NodeType

function isProsemirrorFragment()

Checks to see if the passed value is a ProsemirrorNode

Signature:

export declare function isProsemirrorFragment(value: unknown): value is Fragment;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is Fragment

function isProsemirrorMark()

Checks to see if the passed value is a ProsemirrorMark

Signature:

export declare function isProsemirrorMark(value: unknown): value is Mark;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is Mark

function isProsemirrorNode()

Checks to see if the passed value is a ProsemirrorNode

Signature:

export declare function isProsemirrorNode(value: unknown): value is ProsemirrorNode;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is ProsemirrorNode

function isRemirrorJSON()

Checks whether the passed in JSON is a valid object node

Signature:

export declare function isRemirrorJSON(value: unknown): value is RemirrorJSON;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is RemirrorJSON

function isResolvedPos()

Predicate checking whether the value is a ResolvedPosition.

Signature:

export declare function isResolvedPos(value: unknown): value is PMResolvedPos;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is PMResolvedPos

function isSafari()

Taken from https://stackoverflow.com/a/4900484

Check that the browser is safari. Supports passing a minimum version to check that it is a greater than or equal to this version.

Signature:

export declare function isSafari(minVersion?: number): boolean;

Parameters:

ParameterTypeDescription
minVersionnumber(Optional)

Returns:

boolean

function isSelection()

Predicate checking whether the value is a Selection

Signature:

export declare function isSelection(value: unknown): value is Selection;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is Selection

function isSelectionEmpty()

Checks whether the selection or state is currently empty.

Signature:

export declare function isSelectionEmpty(value: Transaction | EditorState | Selection): boolean;

Parameters:

ParameterTypeDescription
valueTransaction | EditorState | Selectionthe transaction selection or state

Returns:

boolean

function isStartOfDoc()

Returns true when the selection is a text selection at the start of the document.

Signature:

export declare function isStartOfDoc(selection: Selection): boolean;

Parameters:

ParameterTypeDescription
selectionSelection

Returns:

boolean

function isStartOfTextBlock()

Checks that the selection is an empty text selection at the start of its parent node.

Signature:

export declare function isStartOfTextBlock(selection: Selection): selection is TextSelection;

Parameters:

ParameterTypeDescription
selectionSelection

Returns:

selection is TextSelection

function isTextDomNode()

Checks for a text node.

Signature:

export declare function isTextDomNode(domNode: unknown): domNode is Text;

Parameters:

ParameterTypeDescription
domNodeunknownthe dom node

Returns:

domNode is Text

function isTextSelection()

Predicate checking whether the selection is a TextSelection.

Signature:

export declare function isTextSelection(value: unknown): value is TextSelection;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is TextSelection

function isTransaction()

Checks to see if the passed value is a Prosemirror Transaction

Signature:

export declare function isTransaction(value: unknown): value is PMTransaction;

Parameters:

ParameterTypeDescription
valueunknownthe value to check

Returns:

value is PMTransaction

function joinStyles()

Take the style string attribute and combine it with the provided style object.

Signature:

export declare function joinStyles(styleObject: object, initialStyles?: string): string;

Parameters:

ParameterTypeDescription
styleObjectobject
initialStylesstring(Optional)

Returns:

string

function lift()

Lift the selected block, or the closest ancestor block of the selection that can be lifted, out of its parent node.

Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/3126d5c625953ba590c5d3a0db7f1009f46f1571/src/commands.js\#L212-L221

Signature:

export declare function lift({ tr, dispatch }: Pick<CommandFunctionProps, 'tr' | 'dispatch'>): boolean;

Parameters:

ParameterTypeDescription
{ tr, dispatch }Pick<CommandFunctionProps, 'tr' | 'dispatch'>

Returns:

boolean

function markEqualsType()

Checks if the type a given node has a given nodeType.

Signature:

export declare function markEqualsType(props: MarkEqualsTypeProps): boolean;

Parameters:

ParameterTypeDescription
propsMarkEqualsTypeProps

Returns:

boolean

function markInputRule()

Creates an input rule based on the provided regex for the provided mark type.

Signature:

export declare function markInputRule(props: MarkInputRuleProps): SkippableInputRule;

Parameters:

ParameterTypeDescription
propsMarkInputRuleProps

Returns:

SkippableInputRule

function mergeKeyBindings()

This merges an array of keybindings into one keybinding with the priority given to the items earlier in the array. index: 0 has priority over index: 1 which has priority over index: 2 and so on.

This is for use on remirror keybindings. See mergeProsemirrorKeyBindings for transforming the methods into ProsemirrorCommandFunction's.

Signature:

export declare function mergeKeyBindings(extensionKeymaps: KeyBindings[]): KeyBindings;

Parameters:

ParameterTypeDescription
extensionKeymapsKeyBindings[]

Returns:

KeyBindings

function mergeProsemirrorKeyBindings()

This merges an array of keybindings into one keybinding with the priority given to the items earlier in the array. index: 0 has priority over index: 1 which has priority over index: 2 and so on.

This supports the [[ProsemirrorCommandFunction]] type signature where the state, dispatch and view are passed as separate arguments.

Signature:

export declare function mergeProsemirrorKeyBindings(extensionKeymaps: KeyBindings[]): ProsemirrorKeyBindings;

Parameters:

ParameterTypeDescription
extensionKeymapsKeyBindings[]

Returns:

ProsemirrorKeyBindings

function nodeInputRule()

Creates a node input rule based on the provided regex for the provided node type.

Input rules transform content as the user types based on whether a match is found with a sequence of characters.

Signature:

export declare function nodeInputRule(props: NodeInputRuleProps): SkippableInputRule;

Parameters:

ParameterTypeDescription
propsNodeInputRuleProps

Returns:

SkippableInputRule

function omitExtraAttributes()

Return attributes for a node excluding those that were provided as extra attributes.

Signature:

export declare function omitExtraAttributes<Output extends object = DOMCompatibleAttributes>(attrs: ProsemirrorAttributes, extra: ApplySchemaAttributes): Omit<Output, keyof Remirror.Attributes>;

Parameters:

ParameterTypeDescription
attrsProsemirrorAttributesThe source attributes
extraApplySchemaAttributesThe extra attribute schema for this node

Returns:

Omit<Output, keyof Remirror.Attributes>

function parseSizeUnit()

Parse the font size and font unit from the provided value. When the value type is unsupported it default to px.

Signature:

export declare function parseSizeUnit(fontSize?: string | undefined | null): ParsedDomSize;

Parameters:

ParameterTypeDescription
fontSizestring | undefined | null(Optional)

Returns:

ParsedDomSize

function plainInputRule()

Creates a plain rule based on the provided regex. You can see this being used in the @remirror/extension-emoji when it is setup to use plain text.

Signature:

export declare function plainInputRule(props: PlainInputRuleProps): SkippableInputRule;

Parameters:

ParameterTypeDescription
propsPlainInputRuleProps

Returns:

SkippableInputRule

function preserveSelection()

Checks the selection for the current state and updates the active transaction to a selection that is consistent with the initial selection.

Signature:

export declare function preserveSelection(selection: Selection, tr: Transaction): void;

Parameters:

ParameterTypeDescription
selectionSelection
trTransactionthe transaction which has been updated and may have impacted the selection.

Returns:

void

function prosemirrorNodeToDom()

Convert a node into its DOM representative

Signature:

export declare function prosemirrorNodeToDom(node: ProsemirrorNode, document?: Document): DocumentFragment | HTMLElement;

Parameters:

ParameterTypeDescription
nodeProsemirrorNodethe node to extract html from.
documentDocument(Optional) the document to use for the DOM

Returns:

DocumentFragment | HTMLElement

function prosemirrorNodeToHtml()

Convert the provided node to a html string.

Signature:

export declare function prosemirrorNodeToHtml(node: ProsemirrorNode, document?: Document): string;

Parameters:

ParameterTypeDescription
nodeProsemirrorNodethe node to extract html from.
documentDocument

(Optional) the document to use for the DOM

import { EditorState, prosemirrorNodeToHtml } from 'remirror';

function convertStateToHtml(state: EditorState): string {
return prosemirrorNodeToHtml(state.doc);
}

|

Returns:

string

function rangeHasMark()

A wrapper for ProsemirrorNode.rangeHasMark that can also compare mark attributes (if supplied)

Signature:

export declare function rangeHasMark(props: RangeHasMarkProps): boolean;

Parameters:

ParameterTypeDescription
propsRangeHasMarkPropssee [[RangeHasMarkProps]] for options

Returns:

boolean

function removeMark()

Removes a mark from the current selection or provided range.

Signature:

export declare function removeMark(props: RemoveMarkProps): CommandFunction;

Parameters:

ParameterTypeDescription
propsRemoveMarkPropssee [[RemoveMarkProps]] for options

Returns:

CommandFunction

function removeNodeAfter()

Warning: This API is now obsolete.

This util is hard to use and not that useful

Update the transaction to delete the node after the current selection.

dispatch(removeNodeBefore(state.tr));

Signature:

export declare function removeNodeAfter(tr: Transaction): Transaction;

Parameters:

ParameterTypeDescription
trTransaction

Returns:

Transaction

function removeNodeAtPosition()

Performs a delete transaction that removes a node at a given position with the given node. position should point at the position immediately before the node.

Signature:

export declare function removeNodeAtPosition({ pos, tr }: RemoveNodeAtPositionProps): Transaction;

Parameters:

ParameterTypeDescription
{ pos, tr }RemoveNodeAtPositionProps

Returns:

Transaction

function removeNodeBefore()

Warning: This API is now obsolete.

This util is hard to use and not that useful

Updates the provided transaction to remove the node before.

dispatch(
removeNodeBefore(state.tr)
);

Signature:

export declare function removeNodeBefore(tr: Transaction): Transaction;

Parameters:

ParameterTypeDescription
trTransaction

Returns:

Transaction

function replaceNodeAtPosition()

Replaces the node at the provided position with the provided content.

Signature:

export declare function replaceNodeAtPosition({ pos, tr, content, }: ReplaceNodeAtPositionProps): Transaction;

Parameters:

ParameterTypeDescription
{ pos, tr, content, }ReplaceNodeAtPositionProps

Returns:

Transaction

function replaceText()

Replaces text with an optional appended string at the end.

Signature:

export declare function replaceText(props: ReplaceTextProps): CommandFunction;

Parameters:

ParameterTypeDescription
propsReplaceTextPropssee [[ReplaceTextProps]]

Returns:

CommandFunction

function schemaToJSON()

Converts a schema to a JSON compatible object.

Signature:

export declare function schemaToJSON<Nodes extends string = string, Marks extends string = string>(schema: EditorSchema): SchemaJSON<Nodes, Marks>;

Parameters:

ParameterTypeDescription
schemaEditorSchema

Returns:

SchemaJSON<Nodes, Marks>

function setBlockType()

Returns a command that tries to set the selected textblocks to the given node type with the given attributes.

Signature:

export declare function setBlockType(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection, preserveAttrs?: boolean): CommandFunction;

Parameters:

ParameterTypeDescription
nodeTypestring | NodeTypethe name of the node or the [[NodeType]].
attrsProsemirrorAttributes(Optional)
selectionPrimitiveSelection(Optional)
preserveAttrsboolean(Optional)

Returns:

CommandFunction

function setStyle()

Set more styles to the given element.

Signature:

export declare function setStyle(target: HTMLElement, styles: Partial<CSSStyleDeclaration>): Partial<CSSStyleDeclaration>;

Parameters:

ParameterTypeDescription
targetHTMLElement
stylesPartial<CSSStyleDeclaration>

Returns:

Partial<CSSStyleDeclaration>

function shouldUseDomEnvironment()

Checks which environment should be used. Returns true when we are in the dom environment.

Signature:

export declare function shouldUseDomEnvironment(): boolean;

Returns:

boolean

function startPositionOfParent()

Get the start position of the parent of the current resolve position

Signature:

export declare function startPositionOfParent($pos: ResolvedPos): number;

Parameters:

ParameterTypeDescription
$posResolvedPosthe resolved ProseMirror position

Returns:

number

function textBetween()

Find the different ranges of text between a provided range with support for traversing multiple nodes.

Signature:

export declare function textBetween(props: TextBetweenProps): TextBetween[];

Parameters:

ParameterTypeDescription
propsTextBetweenProps

Returns:

TextBetween[]

function toggleBlockItem()

Toggle a block between the provided type and toggleType.

Signature:

export declare function toggleBlockItem(toggleProps: ToggleBlockItemProps): CommandFunction;

Parameters:

ParameterTypeDescription
togglePropsToggleBlockItemPropssee [[ToggleBlockItemProps]] for available options

Returns:

CommandFunction

function toggleWrap()

Toggle between wrapping an inactive node with the provided node type, and lifting it up into it's parent.

Signature:

export declare function toggleWrap(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;

Parameters:

ParameterTypeDescription
nodeTypestring | NodeTypethe node type to toggle
attrsProsemirrorAttributes(Optional) the attrs to use for the node
selectionPrimitiveSelection(Optional)

Returns:

CommandFunction

function updateMark()

Update the selection with the provided MarkType.

Signature:

export declare function updateMark(props: UpdateMarkProps): CommandFunction;

Parameters:

ParameterTypeDescription
propsUpdateMarkPropssee [[UpdateMarkProps]] for options

Returns:

CommandFunction

function wrapIn()

Wrap the selection or the provided text in a node of the given type with the given attributes.

Signature:

export declare function wrapIn(type: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;

Parameters:

ParameterTypeDescription
typestring | NodeType
attrsProsemirrorAttributes(Optional)
selectionPrimitiveSelection(Optional)

Returns:

CommandFunction

variable DOM_SIZE_UNITS

Signature:

DOM_SIZE_UNITS: readonly ["px", "rem", "em", "in", "q", "mm", "cm", "pt", "pc", "vh", "vw", "vmin", "vmax"]

variable environment

A object with flags identifying the current environment.

Signature:

environment: {
readonly isBrowser: boolean;
readonly isJSDOM: boolean;
readonly isNode: boolean;
readonly isIos: boolean;
readonly isMac: boolean;
readonly isApple: boolean;
readonly isDevelopment: boolean;
readonly isTest: boolean;
readonly isProduction: boolean;
}

variable findBlockNodes

Returns block descendants of a given node.

Signature:

findBlockNodes: (props: BaseFindProps) => NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const blockNodes = findBlockNodes(node);

variable findInlineNodes

Returns inline nodes of a given node.

Signature:

findInlineNodes: (props: BaseFindProps) => NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const inlineNodes = findInlineNodes(node);

variable findTextNodes

Returns text nodes of a given node.

Signature:

findTextNodes: (props: BaseFindProps) => NodeWithPosition[]

Remarks:

It doesn't descend into a node when descend argument is false (defaults to true).

const textNodes = findTextNodes({ node });

interface CreateDocumentNodeProps

Signature:

export interface CreateDocumentNodeProps extends SchemaProps, Partial<CustomDocumentProps>, StringHandlerProps 

Extends: SchemaProps, Partial<CustomDocumentProps>, StringHandlerProps

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

property content

The content to render

Signature:

content: RemirrorContentType;

property onError

The error handler which is called when the JSON passed is invalid.

Signature:

onError?: InvalidContentHandler;

property selection

The selection that the user should have in the created node.

TODO add 'start' | 'end' | number for a better developer experience.

Signature:

selection?: PrimitiveSelection;

property stringHandler

A function which transforms a string into a prosemirror node.

Signature:

stringHandler?: StringHandler;

Remarks:

Can be used to transform markdown / html or any other string format into a prosemirror node.

See [[fromHTML]] for an example of how this could work.

interface CustomDocumentProps

Signature:

export interface CustomDocumentProps 

property document

The root or custom document to use when referencing the dom.

This can be used to support SSR.

Signature:

document: Document;

interface FindProsemirrorNodeResult

Signature:

export interface FindProsemirrorNodeResult extends ProsemirrorNodeProps 

Extends: ProsemirrorNodeProps

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

property depth

The depth the node. Equal to 0 if node is the root.

Signature:

depth: number;

property end

The end position of the node.

Signature:

end: number;

property pos

Points to position directly before the node.

Signature:

pos: number;

property start

The start position of the node.

Signature:

start: number;

interface FragmentStringHandlerOptions

Signature:

export interface FragmentStringHandlerOptions extends BaseStringHandlerOptions 

Extends: BaseStringHandlerOptions

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

property fragment

When true will create a fragment from the provided string.

Signature:

fragment: true;

interface GetMarkRange

Signature:

export interface GetMarkRange extends FromToProps 

Extends: FromToProps

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

property mark

The mark that was found within the active range.

Signature:

mark: Mark;

property text

The text contained by this mark.

Signature:

text: string;

interface InvalidContentBlock

A description of an invalid content block (representing a node or a mark).

Signature:

export interface InvalidContentBlock 

property invalidParentMark

Whether this block has any invalid wrapping marks.

Signature:

invalidParentMark: boolean;

property invalidParentNode

Whether this block already has an invalid parent node. Invalid blocks are displayed from the deepest content outward. By checking whether a parent has already been identified as invalid you can choose to only transform the root invalid node.

Signature:

invalidParentNode: boolean;

property name

The name of the node or mark that is invalid.

Signature:

name: string;

property path

The json path to the invalid part of the RemirrorJSON object.

Signature:

path: Array<string | number>;

property type

The type of content that is invalid.

Signature:

type: 'mark' | 'node';

interface InvalidContentHandlerProps

This interface is used when there is an attempt to add content to a schema

Signature:

export interface InvalidContentHandlerProps 

property error

The error that was thrown.

Signature:

error: Error;

property invalidContent

The list of invalid nodes and marks.

Signature:

invalidContent: InvalidContentBlock[];

property json

The JSON representation of the content that caused the error.

Signature:

json: RemirrorJSON;

property transformers

Transformers can be used to apply certain strategies for dealing with invalid content.

Signature:

transformers: typeof transformers;

interface NodeStringHandlerOptions

Signature:

export interface NodeStringHandlerOptions extends BaseStringHandlerOptions 

Extends: BaseStringHandlerOptions

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

property fragment

Signature:

fragment?: false;

interface NodeWithPosition

A node with it's start position.

Signature:

export interface NodeWithPosition extends ProsemirrorNodeProps, PosProps 

Extends: ProsemirrorNodeProps, PosProps

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

interface RemoveMarkProps

Signature:

export interface RemoveMarkProps extends MakeNullable<MarkTypeProps, 'type'> 

Extends: MakeNullable<MarkTypeProps, 'type'>

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

property expand

Whether to expand empty selections to the current mark range.

Signature:

expand?: boolean;

property range

Warning: This API is now obsolete.

use selection property instead.

Signature:

range?: FromToProps;

property selection

The selection to apply to the command.

Signature:

selection?: PrimitiveSelection;

interface ReplaceTextProps

Signature:

export interface ReplaceTextProps extends Partial<AttributesProps> 

Extends: Partial<AttributesProps>

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

property appendText

The text to append.

Signature:

appendText?: string;

property content

Optional text content to include.

Signature:

content?: string;

property keepSelection

Whether to keep the original selection after the replacement.

Signature:

keepSelection?: boolean;

property range

Warning: This API is now obsolete.

  • use selection instead.

Signature:

range?: FromToProps;

property selection

The selected part of the document to replace.

Signature:

selection?: PrimitiveSelection;

property type

The content type to be inserted in place of the range / selection.

Signature:

type?: NodeType | MarkType | string;

interface SchemaJSON

The ProseMirror Schema as a JSON object.

Signature:

export interface SchemaJSON<Nodes extends string = string, Marks extends string = string> 

property marks

The marks within the schema.

Signature:

marks: Record<Marks, MarkSpec>;

property nodes

The nodes of the schema.

Signature:

nodes: Record<Nodes, NodeSpec>;

interface ShouldSkipProps

Signature:

export interface ShouldSkipProps extends EditorStateProps, UpdateCaptureTextProps 

Extends: EditorStateProps, UpdateCaptureTextProps

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

property ruleType

The type of input rule that has been activated

Signature:

ruleType: 'mark' | 'node' | 'plain';

interface StringHandler

A function that converts a string into a ProsemirrorNode.

Signature:

export interface StringHandler 

Signature:

(params: NodeStringHandlerOptions): ProsemirrorNode;

Signature:

(params: FragmentStringHandlerOptions): Fragment;

interface StringHandlerProps

Signature:

export interface StringHandlerProps 

property stringHandler

A function which transforms a string into a prosemirror node.

Signature:

stringHandler?: StringHandler;

Remarks:

Can be used to transform markdown / html or any other string format into a prosemirror node.

See [[fromHTML]] for an example of how this could work.

interface ToggleBlockItemProps

Signature:

export interface ToggleBlockItemProps extends NodeTypeProps, Partial<AttributesProps> 

Extends: NodeTypeProps, Partial<AttributesProps>

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

property preserveAttrs

Whether to preserve the attrs when toggling a block item. This means that extra attributes that are shared between nodes will be maintained.

Signature:

preserveAttrs?: boolean;

property toggleType

The type to toggle back to. Usually this is the paragraph node type.

Signature:

toggleType?: NodeType | string;

interface UpdateMarkProps

Signature:

export interface UpdateMarkProps extends Partial<RangeProps>, Partial<AttributesProps> 

Extends: Partial<RangeProps>, Partial<AttributesProps>

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

property appendText

The text to append.

Signature:

appendText?: string;

property type

The type of the

Signature:

type: MarkType;

type DomSizeUnit

Signature:

export declare type DomSizeUnit = typeof DOM_SIZE_UNITS[number];

References: DOM_SIZE_UNITS

type InvalidContentHandler

The error handler function which should return a valid content type to prevent further errors.

Signature:

export declare type InvalidContentHandler = (props: InvalidContentHandlerProps) => RemirrorContentType;

References: InvalidContentHandlerProps

type NamedStringHandlers

This type is the combination of all the registered string handlers for the extension. This is used rather than the StringHandlers in order to enforce the type signature of the handler method, which isn't possible with the interface.

Signature:

export declare type NamedStringHandlers = {
[K in keyof Remirror.StringHandlers]: StringHandler;
};

References: StringHandler

type ParsedDomSize

A tuple for the font size and unit.

Signature:

export declare type ParsedDomSize = [size: number, unit: DomSizeUnit];

References: DomSizeUnit

type ShouldSkipFunction

A function which is called to check whether an input rule should be skipped.

  • When it returns false then it won't be skipped. - When it returns true then it will be skipped.

Signature:

export declare type ShouldSkipFunction = (props: ShouldSkipProps) => boolean;

References: ShouldSkipProps

type SkippableInputRule

An input rule which can have a shouldSkip property that returns true when the input rule should be skipped.

Signature:

export declare type SkippableInputRule = ShouldSkip & InputRule;

type StringHandlerOptions

Signature:

export declare type StringHandlerOptions = NodeStringHandlerOptions | FragmentStringHandlerOptions;

References: NodeStringHandlerOptions, FragmentStringHandlerOptions