Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remirror/core-utils

Package Overview
Dependencies
Maintainers
2
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/core-utils - npm Package Compare versions

Comparing version 2.0.13 to 3.0.0-beta.0

dist/_tsup-dts-rollup.d.cts

4

dist-types/keyboard-utils.d.ts

@@ -1,2 +0,2 @@

import { MessageDescriptor } from '@remirror/messages';
import type { RemirrorMessage } from '@remirror/core-types';
interface BaseKeyboardSymbol {

@@ -12,3 +12,3 @@ /**

*/
i18n: MessageDescriptor;
i18n: RemirrorMessage;
}

@@ -15,0 +15,0 @@ interface ModifierKeyboardSymbol extends I18nKeyboardSymbol {

@@ -1,1609 +0,166 @@

import { RangeProps, AttributesProps, MarkType, CommandFunction, CommandFunctionProps, NodeType, ProsemirrorAttributes, PrimitiveSelection, NodeTypeProps, FromToProps, Selection, Transaction, MakeNullable, MarkTypeProps, RemirrorIdentifierShape, EditorSchema, ProsemirrorNode, EditorState as EditorState$1, ResolvedPos as ResolvedPos$1, AnyConstructor, RemirrorJSON, SchemaProps, RemirrorContentType, DOMCompatibleAttributes, ApplySchemaAttributes, TrStateProps, PosProps, TextProps, KebabCase, StringKey, ProsemirrorNodeProps, OptionalProsemirrorNodeProps, Primitive, PredicateProps, EditorStateProps, GetAttributesProps, RegExpProps, TransactionProps, EditorView, KeyBindingCommandFunction, KeyBindings, ProsemirrorKeyBindings, Mark as Mark$1, NodeTypesProps, MarkTypesProps, OptionalMarkProps, Fragment as Fragment$1, SelectionProps } from '@remirror/core-types';
import { RemirrorIdentifier } from '@remirror/core-constants';
import { NodeType as NodeType$1, MarkType as MarkType$1, Fragment, Mark, ResolvedPos, NodeRange, Slice, ParseOptions, NodeSpec, MarkSpec } from '@remirror/pm/model';
import { EditorState, Transaction as Transaction$1, TextSelection, AllSelection, NodeSelection } from '@remirror/pm/state';
import { Step } from '@remirror/pm/transform';
import { MessageDescriptor } from '@remirror/messages';
import { InputRule } from '@remirror/pm/inputrules';
export { chainCommands, chainableEditorState, convertCommand, nonChainable } from '@remirror/pm';
interface UpdateMarkProps extends Partial<RangeProps>, Partial<AttributesProps> {
/**
* The text to append.
*
* @defaultValue '''
*/
appendText?: string;
/**
* The type of the
*/
type: MarkType;
}
/**
* Update the selection with the provided MarkType.
*
* @param props - see [[`UpdateMarkProps`]] for options
*/
declare function updateMark(props: UpdateMarkProps): CommandFunction;
/**
* 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
*/
declare function lift({ tr, dispatch }: Pick<CommandFunctionProps, 'tr' | 'dispatch'>): boolean;
/**
* Wrap the selection or the provided text in a node of the given type with the
* given attributes.
*/
declare function wrapIn(type: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;
/**
* Toggle between wrapping an inactive node with the provided node type, and
* lifting it up into it's parent.
*
* @param nodeType - the node type to toggle
* @param attrs - the attrs to use for the node
*/
declare function toggleWrap(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection): CommandFunction;
/**
* Returns a command that tries to set the selected textblocks to the
* given node type with the given attributes.
*
* @param nodeType - the name of the node or the [[`NodeType`]].
*/
declare function setBlockType(nodeType: string | NodeType, attrs?: ProsemirrorAttributes, selection?: PrimitiveSelection, preserveAttrs?: boolean): CommandFunction;
interface ToggleBlockItemProps extends NodeTypeProps, Partial<AttributesProps> {
/**
* The type to toggle back to. Usually this is the `paragraph` node type.
*
* @defaultValue 'paragraph'
*/
toggleType?: NodeType | string;
/**
* Whether to preserve the attrs when toggling a block item. This means that
* extra attributes that are shared between nodes will be maintained.
*
* @defaultValue true
*/
preserveAttrs?: boolean;
}
/**
* Toggle a block between the provided type and toggleType.
*
* @param toggleProps - see [[`ToggleBlockItemProps`]] for available options
*/
declare function toggleBlockItem(toggleProps: ToggleBlockItemProps): CommandFunction;
interface ReplaceTextProps extends Partial<AttributesProps> {
/**
* The text to append.
*
* @defaultValue '''
*/
appendText?: string;
/**
* Optional text content to include.
*/
content?: string;
/**
* The content type to be inserted in place of the range / selection.
*/
type?: NodeType | MarkType | string;
/**
* Whether to keep the original selection after the replacement.
*/
keepSelection?: boolean;
/**
* @deprecated - use `selection` instead.
*/
range?: FromToProps;
/**
* The selected part of the document to replace.
*/
selection?: PrimitiveSelection;
}
/**
* 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.
*/
declare function isChrome(minVersion?: number): boolean;
/**
* 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.
*/
declare function isSafari(minVersion?: number): boolean;
/**
* Checks the selection for the current state and updates the active transaction
* to a selection that is consistent with the initial selection.
*
* @param state - the editor state before any updates
* @param tr - the transaction which has been updated and may have impacted the
* selection.
*/
declare function preserveSelection(selection: Selection, tr: Transaction): void;
/**
* Replaces text with an optional appended string at the end.
*
* @param props - see [[`ReplaceTextProps`]]
*/
declare function replaceText(props: ReplaceTextProps): CommandFunction;
interface RemoveMarkProps extends MakeNullable<MarkTypeProps, 'type'> {
/**
* Whether to expand empty selections to the current mark range.
*
* @defaultValue true
*/
expand?: boolean;
/**
* @deprecated use `selection` property instead.
*/
range?: FromToProps;
/**
* The selection to apply to the command.
*/
selection?: PrimitiveSelection;
}
/**
* Removes a mark from the current selection or provided range.
*
* @param props - see [[`RemoveMarkProps`]] for options
*/
declare function removeMark(props: RemoveMarkProps): CommandFunction;
/**
* Identifies the value as having a remirror identifier. This is the core
* predicate check for the remirror library.
*
* @param value - the value to be checked
*
* @internal
*/
declare function isRemirrorType(value: unknown): value is RemirrorIdentifierShape;
/**
* Checks that the provided remirror shape is of a given type.
*
* @param value - any remirror shape
* @param type - the remirror identifier type to check for
*
* @internal
*/
declare function isIdentifierOfType(value: RemirrorIdentifierShape, type: RemirrorIdentifier | RemirrorIdentifier[]): boolean;
/**
* Check to see if the passed value is a NodeType.
*
* @param value - the value to check
*/
declare function isNodeType(value: unknown): value is NodeType$1;
/**
* Get the node type from a potential string value.
*/
declare function getNodeType(type: string | NodeType$1, schema: EditorSchema): NodeType$1;
/**
* Check to see if the passed value is a MarkType.
*
* @param value - the value to check
*/
declare function isMarkType(value: unknown): value is MarkType$1;
/**
* Get the mark type from a potential string value.
*/
declare function getMarkType(type: string | MarkType$1, schema: EditorSchema): MarkType$1;
/**
* Checks to see if the passed value is a ProsemirrorNode
*
* @param value - the value to check
*/
declare function isProsemirrorNode(value: unknown): value is ProsemirrorNode;
/**
* Checks to see if the passed value is a ProsemirrorNode
*
* @param value - the value to check
*/
declare function isProsemirrorFragment(value: unknown): value is Fragment;
/**
* Checks to see if the passed value is a ProsemirrorMark
*
* @param value - the value to check
*/
declare function isProsemirrorMark(value: unknown): value is Mark;
/**
* Checks to see if the passed value is a Prosemirror Editor State
*
* @param value - the value to check
*/
declare function isEditorState(value: unknown): value is EditorState | Readonly<EditorState>;
/**
* Checks to see if the passed value is a Prosemirror Transaction
*
* @param value - the value to check
*/
declare function isTransaction(value: unknown): value is Transaction$1;
/**
* Checks to see if the passed value is an instance of the editor schema
*
* @param value - the value to check
*/
declare function isEditorSchema(value: unknown): value is EditorSchema;
/**
* Predicate checking whether the selection is a `TextSelection`.
*
* @param value - the value to check
*/
declare function isTextSelection(value: unknown): value is TextSelection;
/**
* Predicate checking whether the selection is an `AllSelection`.
*
* @param value - the value to check
*/
declare function isAllSelection(value: unknown): value is AllSelection;
/**
* Predicate checking whether the value is a Selection
*
* @param value - the value to check
*/
declare function isSelection(value: unknown): value is Selection;
/**
* Predicate checking whether the value is a ResolvedPosition.
*
* @param value - the value to check
*/
declare function isResolvedPos(value: unknown): value is ResolvedPos;
interface RangeHasMarkProps extends TrStateProps, FromToProps, MarkTypeProps, Partial<AttributesProps> {
}
/**
* A wrapper for ProsemirrorNode.rangeHasMark that can also compare mark attributes (if supplied)
*
* @param props - see [[`RangeHasMarkProps`]] for options
*/
declare function rangeHasMark(props: RangeHasMarkProps): boolean;
/**
* Predicate checking whether the selection is a NodeSelection
*
* @param value - the value to check
*/
declare function isNodeSelection(value: unknown): value is NodeSelection;
interface IsMarkActiveProps extends MarkTypeProps, Partial<AttributesProps>, Partial<FromToProps>, TrStateProps {
}
/**
* 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.
*
* @param props - see [[`IsMarkActiveProps`]] for options
*/
declare function isMarkActive(props: IsMarkActiveProps): boolean;
/**
* Check if the specified type (NodeType) can be inserted at the current
* selection point.
*
* @param state - the editor state
* @param type - the node type
*/
declare function canInsertNode(state: EditorState$1, type: NodeType$1): boolean;
/**
* Checks if a node looks like an empty document.
*
* @param node - the prosemirror node
*/
declare function isDocNodeEmpty(node: ProsemirrorNode): boolean;
interface DefaultDocNodeOptions {
/**
* When true will not check any of the attributes for any of the nodes.
*/
ignoreAttributes?: boolean;
/**
* Set this to true to only test whether the content is identical to the
* default and not the parent node.
*/
ignoreDocAttributes?: boolean;
}
/**
* 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.
*/
declare function isDefaultDocNode(doc: ProsemirrorNode, options?: DefaultDocNodeOptions): boolean;
/**
* Get the default `doc` node for a given schema.
*/
declare function getDefaultDocNode(schema: EditorSchema): ProsemirrorNode | undefined;
/**
* Get the default block node from the schema.
*/
declare function getDefaultBlockNode(schema: EditorSchema): NodeType$1;
/**
* Check if the provided node is a default block node.
*/
declare function isDefaultBlockNode(node: ProsemirrorNode): boolean;
/**
* Checks if the current node is a block node and empty.
*
* @param node - the prosemirror node
*/
declare function isEmptyBlockNode(node: ProsemirrorNode | null | undefined): boolean;
/**
* Retrieve the attributes for a mark.
*
* @param trState - the editor state or a transaction
* @param type - the mark type
*/
declare function getMarkAttributes(trState: EditorState$1 | Transaction, type: MarkType$1): ProsemirrorAttributes | false;
interface GetMarkRange extends FromToProps {
/**
* The mark that was found within the active range.
*/
mark: Mark;
/**
* The text contained by this mark.
*/
text: string;
}
/**
* Retrieve the `start` and `end` position of a mark. The `$pos` value should be
* calculated via `tr.doc.resolve(number)`.
*
* @remarks
*
* @param $pos - the resolved ProseMirror position
* @param type - the mark type
* @param $end - 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`]].
*/
declare function getMarkRange($pos: ResolvedPos$1, type: string | MarkType$1, $end?: ResolvedPos$1): GetMarkRange | undefined;
/**
* Get all the ranges which contain marks for the provided selection.
*/
declare function getMarkRanges(selection: Selection, type: string | MarkType$1): GetMarkRange[];
interface ChangedRange extends FromToProps {
/**
* The previous starting position in the document.
*/
prevFrom: number;
/**
* The previous ending position in the document.
*/
prevTo: number;
}
/**
* 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)
*
* @param tr - the transaction received with updates applied.
* @param StepTypes - the valid Step Constructors. Set to an empty array to
* accept all Steps.
*/
declare function getChangedRanges(tr: Transaction, StepTypes?: Array<AnyConstructor<Step>>): ChangedRange[];
/**
* Get all the changed node ranges for a provided transaction.
*
* @param tr - the transaction received with updates applied.
* @param StepTypes - the valid Step Constructors. Set to an empty array to
* accept all Steps.
*/
declare function getChangedNodeRanges(tr: Transaction, StepTypes?: Array<AnyConstructor<Step>>): NodeRange[];
/**
* Retrieves the text content from a slice
*
* @remarks
* A utility that's useful for pulling text content from a slice which is
* usually created via `selection.content()`
*
* @param slice - the prosemirror slice
*/
declare function getTextContentFromSlice(slice: Slice): string;
interface GetSelectedGroup extends FromToProps {
/**
* The capture text within the group.
*/
text: string;
}
/**
* Takes an empty selection and expands it out to the nearest group not matching
* the excluded characters.
*
* @remarks
*
* Can be used to find the nearest selected word. See {@link getSelectedWord}
*
* @param state - the editor state or a transaction
* @param exclude - the regex pattern to exclude
* @returns false if not a text selection or if no expansion available
*/
declare function getSelectedGroup(state: EditorState$1 | Transaction, exclude: RegExp): GetSelectedGroup | undefined;
/**
* Retrieves the nearest space separated word from the current selection.
*
* @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.
*
* @param state - the editor state or transaction.
*/
declare function getSelectedWord(state: EditorState$1 | Transaction): GetSelectedGroup | undefined;
/**
* Get matching string from a list or single value
*
* @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.
*
* @param match - the match(es)
* @param index - the zero-index point from which to start
*/
declare function getMatchString(match: string | string[], index?: number): string;
/**
* Checks whether the cursor is at the end of the state.doc
*
* @param state - the editor state
*/
declare function atDocEnd(state: EditorState$1): boolean;
/**
* Checks whether the cursor is at the beginning of the state.doc
*
* @param state - the editor state
*/
declare function atDocStart(state: EditorState$1): boolean;
/**
* Get the start position of the parent of the current resolve position
*
* @param $pos - the resolved `ProseMirror` position
*/
declare function startPositionOfParent($pos: ResolvedPos$1): number;
/**
* Get the end position of the parent of the current resolve position
*
* @param $pos - the resolved `ProseMirror` position
*/
declare function endPositionOfParent($pos: ResolvedPos$1): number;
/**
* Retrieve the current position of the cursor
*
* @param selection - the editor selection
* @returns a resolved position only when the selection is a text selection
*/
declare function getCursor(selection: Selection): ResolvedPos$1 | null | undefined;
/**
* Checks whether a Prosemirror node is the top level `doc` node
*
* @param node - the prosemirror node
* @param schema - the prosemirror schema to check against
*/
declare function isDocNode(node: ProsemirrorNode | null | undefined, schema?: EditorSchema): node is ProsemirrorNode;
/**
* Checks whether the passed in JSON is a valid object node
*
* @param value - the value to check
*/
declare function isRemirrorJSON(value: unknown): value is RemirrorJSON;
/**
* 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.
*/
type NamedStringHandlers = {
[K in keyof Remirror.StringHandlers]: StringHandler;
};
interface CreateDocumentNodeProps extends SchemaProps, Partial<CustomDocumentProps>, StringHandlerProps {
/**
* The content to render
*/
content: RemirrorContentType;
/**
* The error handler which is called when the JSON passed is invalid.
*/
onError?: InvalidContentHandler;
/**
* The selection that the user should have in the created node.
*
* TODO add `'start' | 'end' | number` for a better developer experience.
*/
selection?: PrimitiveSelection;
/**
* When an error is thrown the onError handler is called which can return new
* content. The new content is recursively checked to see if it is valid. This
* number is tracks the call depth of the recursive function to prevent it
* exceeding the maximum.
*
* @defaultValue 0
*
* @internal
*/
attempts?: number;
}
/**
* Get the nearest valid selection to the provided selection parameter.
*/
declare function getTextSelection(selection: PrimitiveSelection, doc: ProsemirrorNode): Selection;
/**
* A function that converts a string into a `ProsemirrorNode`.
*/
interface StringHandler {
(params: NodeStringHandlerOptions): ProsemirrorNode;
(params: FragmentStringHandlerOptions): Fragment;
}
interface StringHandlerProps {
/**
* A function which transforms a string into a prosemirror node.
*
* @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.
*/
stringHandler?: StringHandler;
}
/**
* Creates a document node from the passed in content and schema.
*
* @remirror
*
* 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.
*/
declare function createDocumentNode(props: CreateDocumentNodeProps): ProsemirrorNode;
/**
* Checks which environment should be used. Returns true when we are in the dom
* environment.
*/
declare function shouldUseDomEnvironment(): boolean;
/**
* Retrieves the document from global scope and throws an error in a non-browser
* environment.
*
* @internal
*/
declare function getDocument(): Document;
interface CustomDocumentProps {
/**
* The root or custom document to use when referencing the dom.
*
* This can be used to support SSR.
*/
document: Document;
}
/**
* Convert a node into its DOM representative
*
* @param node - the node to extract html from.
* @param document - the document to use for the DOM
*/
declare function prosemirrorNodeToDom(node: ProsemirrorNode, document?: Document): DocumentFragment | HTMLElement;
/**
* Convert the provided `node` to a html string.
*
* @param node - the node to extract html from.
* @param document - the document to use for the DOM
*
* ```ts
* import { EditorState, prosemirrorNodeToHtml } from 'remirror';
*
* function convertStateToHtml(state: EditorState): string {
* return prosemirrorNodeToHtml(state.doc);
* }
* ```
*/
declare function prosemirrorNodeToHtml(node: ProsemirrorNode, document?: Document): string;
interface BaseStringHandlerOptions extends Partial<CustomDocumentProps>, SchemaProps, ParseOptions {
/**
* The string content provided to the editor.
*/
content: string;
}
interface FragmentStringHandlerOptions extends BaseStringHandlerOptions {
/**
* When true will create a fragment from the provided string.
*/
fragment: true;
}
interface NodeStringHandlerOptions extends BaseStringHandlerOptions {
fragment?: false;
}
type StringHandlerOptions = NodeStringHandlerOptions | FragmentStringHandlerOptions;
/**
* 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.
*
* ```tsx
* 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>
* );
* }
* ```
*/
declare function htmlToProsemirrorNode(props: FragmentStringHandlerOptions): Fragment;
declare function htmlToProsemirrorNode(props: NodeStringHandlerOptions): ProsemirrorNode;
/**
* A wrapper around `state.doc.toJSON` which returns the state as a
* `RemirrorJSON` object.
*/
declare function getRemirrorJSON(content: EditorState$1 | ProsemirrorNode): RemirrorJSON;
interface IsStateEqualOptions {
/**
* Whether to compare the selection of the two states.
*
* @defaultValue false
*/
checkSelection?: boolean;
}
/**
* Check if two states are equal.
*/
declare function areStatesEqual(stateA: EditorState$1, stateB: EditorState$1, options?: IsStateEqualOptions): boolean;
/**
* Check that the nodes and marks present on `schemaA` are also present on
* `schemaB`.
*/
declare function areSchemasCompatible(schemaA: EditorSchema, schemaB: EditorSchema): boolean;
/**
* Return attributes for a node excluding those that were provided as extra
* attributes.
*
* @param attrs - The source attributes
* @param extra - The extra attribute schema for this node
*/
declare function omitExtraAttributes<Output extends object = DOMCompatibleAttributes>(attrs: ProsemirrorAttributes, extra: ApplySchemaAttributes): Omit<Output, keyof Remirror.Attributes>;
/**
* Take the `style` string attribute and combine it with the provided style
* object.
*/
declare function joinStyles(styleObject: object, initialStyles?: string): string;
interface TextBetweenProps extends FromToProps {
/**
* The prosemirror `doc` node.
*/
doc: ProsemirrorNode;
}
interface TextBetween extends PosProps, TextProps {
}
/**
* Find the different ranges of text between a provided range with support for
* traversing multiple nodes.
*/
declare function textBetween(props: TextBetweenProps): TextBetween[];
/**
* Get the full range of the selectable content in the ProseMirror `doc`.
*/
declare function getDocRange(doc: ProsemirrorNode): FromToProps;
/**
* A description of an invalid content block (representing a node or a mark).
*/
interface InvalidContentBlock {
/**
* The type of content that is invalid.
*/
type: 'mark' | 'node';
/**
* The name of the node or mark that is invalid.
*/
name: string;
/**
* The json path to the invalid part of the `RemirrorJSON` object.
*/
path: Array<string | number>;
/**
* 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.
*/
invalidParentNode: boolean;
/**
* Whether this block has any invalid wrapping marks.
*/
invalidParentMark: boolean;
}
/**
* This interface is used when there is an attempt to add content to a schema
*/
interface InvalidContentHandlerProps {
/**
* The JSON representation of the content that caused the error.
*/
json: RemirrorJSON;
/**
* The list of invalid nodes and marks.
*/
invalidContent: InvalidContentBlock[];
/**
* The error that was thrown.
*/
error: Error;
/**
* Transformers can be used to apply certain strategies for dealing with
* invalid content.
*/
transformers: typeof transformers;
}
/**
* The error handler function which should return a valid content type to
* prevent further errors.
*/
type InvalidContentHandler = (props: InvalidContentHandlerProps) => RemirrorContentType;
declare const transformers: {
/**
* Remove every invalid block from the editor. This is a destructive action
* and should only be applied if you're sure it's the best strategy.
*
* @param json - the content as a json object.
* @param invalidContent - the list of invalid items as passed to the error
* handler.
*/
remove(json: RemirrorJSON, invalidContent: InvalidContentBlock[]): RemirrorJSON;
};
type GetInvalidContentProps<Extra extends object> = SchemaProps & {
/**
* The RemirrorJSON representation of the invalid content.
*/
json: RemirrorJSON;
} & Extra;
type GetInvalidContentReturn<Extra extends object> = Omit<InvalidContentHandlerProps, 'error'> & Extra;
/**
* Get the invalid parameter which is passed to the `onError` handler.
*/
declare function getInvalidContent<Extra extends object>({ json, schema, ...extra }: GetInvalidContentProps<Extra>): GetInvalidContentReturn<Extra>;
/**
* Checks that the selection is an empty text selection at the end of its parent
* node.
*/
declare function isEndOfTextBlock(selection: Selection): selection is TextSelection;
/**
* Checks that the selection is an empty text selection at the start of its
* parent node.
*/
declare function isStartOfTextBlock(selection: Selection): selection is TextSelection;
/**
* Returns true when the selection is a text selection at the start of the
* document.
*/
declare function isStartOfDoc(selection: Selection): boolean;
declare global {
namespace Remirror {
/**
* This interface provides all the named string handlers. The key is the
* only part that's used meaning the value isn't important. However, it's
* conventional to use the Extension for the value.
*/
interface StringHandlers {
}
}
}
/**
* Get the styles for a given property of an element.
*/
declare function getStyle(element: HTMLElement, property: KebabCase<StringKey<CSSStyleDeclaration>>): string;
/**
* Set more styles to the given element.
*/
declare function setStyle(target: HTMLElement, styles: Partial<CSSStyleDeclaration>): Partial<CSSStyleDeclaration>;
declare const DOM_SIZE_UNITS: readonly ["px", "rem", "em", "in", "q", "mm", "cm", "pt", "pc", "vh", "vw", "vmin", "vmax"];
type DomSizeUnit = (typeof DOM_SIZE_UNITS)[number];
/**
* A tuple for the font size and unit.
*/
type ParsedDomSize = [size: number, unit: DomSizeUnit];
/**
* Parse the font size and font unit from the provided value. When the value
* type is unsupported it default to `px`.
*/
declare function parseSizeUnit(fontSize?: string | undefined | null): ParsedDomSize;
declare function getFontSize(element?: Element | null): string;
/**
* 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
*/
declare function extractPixelSize(size: string, element?: Element | null): number;
/**
* Convert the received font size to a valid unit
*/
declare function convertPixelsToDomUnit(size: string, to: DomSizeUnit, element?: Element | null): number;
/**
* Checks whether the passed value is a valid dom node
*
* @param domNode - the dom node
*/
declare function isDomNode(domNode: unknown): domNode is Node;
/**
* Checks for an element node like `<p>` or `<div>`.
*
* @param domNode - the dom node
*/
declare function isElementDomNode(domNode: unknown): domNode is HTMLElement;
/**
* Checks for a text node.
*
* @param domNode - the dom node
*/
declare function isTextDomNode(domNode: unknown): domNode is Text;
/**
* Merge two DOMRect objects into a one big DOMRect object that contains both two DOMRect objects.
*
* @param rect1 - the first DOMRect
* @param rect2 - the second DOMRect
*/
declare function mergeDOMRects(rect1: DOMRect, rect2: DOMRect): DOMRect;
/**
* A object with flags identifying the current environment.
*/
declare const environment: {
/**
* Verifies that the environment has both a window and window.document
*/
readonly isBrowser: boolean;
/**
* Verifies that the environment is JSDOM
*/
readonly isJSDOM: boolean;
/**
* Verifies that the environment has a nodejs process and is therefore a node environment
*/
readonly isNode: boolean;
/**
* True when on an iOS device.
*/
readonly isIos: boolean;
/**
* True when running on macOS
*/
readonly isMac: boolean;
/**
* Verify that this is an apple device either on the client or server.
*/
readonly isApple: boolean;
/**
* True when running in DEVELOPMENT environment
*/
readonly isDevelopment: boolean;
/**
* True when running unit tests
*/
readonly isTest: boolean;
/**
* True when running in PRODUCTION environment
*/
readonly isProduction: boolean;
};
interface BaseKeyboardSymbol {
/**
* The normalized value for the symbol.
*/
key: string;
}
interface I18nKeyboardSymbol extends BaseKeyboardSymbol {
/**
* The internationalized representation of the key.
*/
i18n: MessageDescriptor;
}
interface ModifierKeyboardSymbol extends I18nKeyboardSymbol {
/**
* Modifier keys like 'shift' | 'alt' | 'meta'.
*/
type: 'modifier';
/**
* The symbol for the modifier key.
*/
symbol: string;
}
interface NamedKeyboardSymbol extends I18nKeyboardSymbol {
/**
* Named keys like `Enter` | `Escape`
*/
type: 'named';
/**
* The potentially undefined symbol for the named key.
*/
symbol?: string;
}
interface CharKeyboardSymbol extends BaseKeyboardSymbol {
/**
* Character keys like `a` | `b`
*/
type: 'char';
}
type KeyboardSymbol = ModifierKeyboardSymbol | NamedKeyboardSymbol | CharKeyboardSymbol;
/**
* Convert a keyboard shortcut into symbols which and keys.
*/
declare function getShortcutSymbols(shortcut: string): KeyboardSymbol[];
interface DescendProps {
/**
* Whether to descend into a node.
*
* @defaultValue true
*/
descend: boolean;
}
type NodePredicateProps = PredicateProps<NodeWithPosition>;
/**
* A node with it's start position.
*/
interface NodeWithPosition extends ProsemirrorNodeProps, PosProps {
}
interface NodeActionProps {
/**
* A method which is run whenever the provided predicate returns true.
*
* This avoids the need for multiple passes over the same data, first to
* gather and then to process. When viable ,why not just get it done.
*/
action?: (node: NodeWithPosition) => void;
}
interface BaseFindProps extends OptionalProsemirrorNodeProps, Partial<DescendProps>, NodeActionProps {
}
interface FindChildrenProps extends BaseFindProps, NodePredicateProps {
}
/**
* Iterates over descendants of a given `node`, returning child nodes predicate
* returns truthy for.
*
* @remarks
*
* It doesn't descend into a node when descend argument is `false` (defaults to
* `true`).
*
* ```ts
* const textNodes = findChildren({
* node: state.doc,
* predicate: child => child.isText,
* descend: false
* });
* ```
*/
declare function findChildren(props: FindChildrenProps): NodeWithPosition[];
/**
* Returns text nodes of a given `node`.
*
* @remarks
* It doesn't descend into a node when descend argument is `false` (defaults to
* `true`).
*
* ```ts
* const textNodes = findTextNodes({ node });
* ```
*/
declare const findTextNodes: (props: BaseFindProps) => NodeWithPosition[];
/**
* Returns inline nodes of a given `node`.
*
* @remarks
* It doesn't descend into a node when descend argument is `false` (defaults to
* `true`).
*
* ```ts
* const inlineNodes = findInlineNodes(node);
* ```
*/
declare const findInlineNodes: (props: BaseFindProps) => NodeWithPosition[];
/**
* Returns block descendants of a given `node`.
*
* @remarks
*
* It doesn't descend into a node when descend argument is `false` (defaults to
* `true`).
*
* ```ts
* const blockNodes = findBlockNodes(node);
* ```
*/
declare const findBlockNodes: (props: BaseFindProps) => NodeWithPosition[];
type AttributePredicate = (props: {
value: unknown;
exists: boolean;
}) => boolean;
interface FindChildrenByAttrProps extends BaseFindProps {
/**
* This can either be any primitive value or a function that takes the `value`
* as the first argument and whether the key exists within the attributes as
* the second argument.
*/
attrs: {
[key: string]: Primitive | AttributePredicate;
};
}
/**
* Iterates over descendants of a given `node`, returning child nodes predicate
* returns truthy for.
*
* @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`.
*
* ```ts
* const mergedCells = findChildrenByAttribute({
* node: table,
* attrs: { colspan: 2, id: (_, exists) => exists }
* });
* ```
*/
declare function findChildrenByAttribute(props: FindChildrenByAttrProps): NodeWithPosition[];
interface FindChildrenByNodeProps extends BaseFindProps, NodeTypeProps {
}
/**
* Iterates over descendants of a given `node`, returning child nodes of a given
* nodeType.
*
* @remarks
*
* It doesn't descend into a node when descend argument is `false` (defaults to
* `true`).
*
* ```ts
* const cells = findChildrenByNode({ node: state.doc, type: state.schema.nodes.tableCell });
* ```
*/
declare function findChildrenByNode(props: FindChildrenByNodeProps): NodeWithPosition[];
interface FindChildrenByMarkProps extends BaseFindProps, MarkTypeProps {
}
/**
* Iterates over descendants of a given `node`, returning child nodes that have
* a mark of a given markType.
*
* @remarks
*
* It doesn't descend into a `node` when descend argument is `false` (defaults
* to `true`).
*
* ```ts
* const nodes = findChildrenByMark({ node: state.doc, type: schema.marks.strong });
* ```
*/
declare function findChildrenByMark(paramter: FindChildrenByMarkProps): NodeWithPosition[];
interface ContainsProps extends ProsemirrorNodeProps, NodeTypeProps {
}
/**
* Returns `true` if a given node contains nodes of a given `nodeType`.
*
* @remarks
*
* ```ts
* if (containsNodesOfType({ node: state.doc, type: schema.nodes.listItem })) {
* log('contained')
* }
* ```
*/
declare function containsNodesOfType(props: ContainsProps): boolean;
interface GetChangedNodesOptions {
/**
* Whether to descend into child nodes.
*
* @defaultValue false
*/
descend?: boolean;
/**
* A predicate test for node which was found. Return `false` to skip the node.
*
* @param node - the node that was found
* @param pos - the pos of that node
* @param range - the `NodeRange` which contained this node.
*/
predicate?: (node: ProsemirrorNode, pos: number, range: NodeRange) => boolean;
/**
* The valid step types to check for. Set to an empty array to accept all
* types.
*
* @defaultValue [ReplaceStep]
*/
StepTypes?: Array<AnyConstructor<Step>>;
}
/**
* Get all the changed nodes from the provided transaction.
*
* The following example will give us all the text nodes in the provided
* transaction.
*
* ```ts
* import { getChangedNodes } from 'remirror/core';
*
* const changedTextNodes = getChangeNodes(tr, { descend: true, predicate: (node) => node.isText });
* ```
*/
declare function getChangedNodes(tr: Transaction, options?: GetChangedNodesOptions): NodeWithPosition[];
interface BeforeDispatchProps extends TransactionProps {
/**
* The matches returned by the regex.
*/
match: string[];
/**
* The start position of the most recently typed character.
*/
start: number;
/**
* The end position of the most recently typed character.
*/
end: number;
}
interface BaseInputRuleProps extends ShouldSkip {
/**
* A method which can be used to add more steps to the transaction after the
* input rule update but before the editor has dispatched to update to a new
* state.
*
* ```ts
* import { nodeInputRule } from 'remirror';
*
* nodeInputRule({
* type,
* regexp: /abc/,
* beforeDispatch?: (props: BeforeDispatchProps) => void; : (tr)
* => tr.insertText('hello')
* });
* ```
*/
beforeDispatch?: (props: BeforeDispatchProps) => void;
/**
* Ignore the match when all characters in the capture group are whitespace.
*
* This helps stop situations from occurring where the a capture group matches
* but you don't want an update if it's all whitespace.
*
* @defaultValue false
*/
ignoreWhitespace?: boolean;
/**
* Update the capture group. This is needed sometimes because lookbehind regex
* don't work in some browsers and can't be transpiled or polyfilled. This
* method allows the developer to update the details of the matching input
* rule details before it is acted on.
*
* The capture group refers to the first match within the matching bracket.
*
* ```ts
* abc.match(/ab(c)/) => ['abc', 'a']
* ```
*
* In the above example the capture group is the first index so in this case
* the captured text would be `a`.
*
* @param captured - All the details about the capture to allow for full
* customisation.
* @returns updated details or undefined to leave unchanged.
*
* See https://github.com/remirror/remirror/issues/574#issuecomment-678700121
* for more context.
*/
updateCaptured?: UpdateCaptured;
}
type UpdateCaptured = (captured: UpdateCaptureTextProps) => Partial<UpdateCaptureTextProps>;
interface NodeInputRuleProps extends Partial<GetAttributesProps>, RegExpProps, NodeTypeProps, BaseInputRuleProps {
}
interface PlainInputRuleProps extends RegExpProps, BaseInputRuleProps {
/**
* A function that transforms the match into the desired value.
*
* Return `null` or `undefined` to invalidate the match.
*/
transformMatch: (match: string[]) => string | null | undefined;
}
interface UpdateCaptureTextProps {
/**
* The first capture group from the matching input rule.
*/
captureGroup: string | undefined;
/**
* The text of the full match which was received.
*/
fullMatch: string;
/**
* The starting position of the match relative to the `doc`.
*/
start: number;
/**
* The end position of the match relative to the `doc`.
*/
end: number;
}
interface MarkInputRuleProps extends Partial<GetAttributesProps>, RegExpProps, MarkTypeProps, BaseInputRuleProps {
}
/**
* Creates an input rule based on the provided regex for the provided mark type.
*/
declare function markInputRule(props: MarkInputRuleProps): SkippableInputRule;
/**
* 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.
*/
declare function nodeInputRule(props: NodeInputRuleProps): SkippableInputRule;
/**
* 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.
*/
declare function plainInputRule(props: PlainInputRuleProps): SkippableInputRule;
interface ShouldSkipProps extends EditorStateProps, UpdateCaptureTextProps {
/** The type of input rule that has been activated */
ruleType: 'mark' | 'node' | 'plain';
}
interface ShouldSkip {
/**
* Every input rule calls this function before deciding whether or not to run.
*
* This is run for every successful input rule match to check if there are any
* reasons to prevent it from running.
*
* In particular it is so that the input rule only runs when there are no
* active checks that prevent it from doing so.
*
* - Other extension can register a `shouldSkip` handler
* - Every time the input rule is running it makes sure it isn't blocked.
*/
shouldSkip?: ShouldSkipFunction;
/**
* A list of marks which if existing in the provided range should invalidate
* the range.
*/
invalidMarks?: string[];
}
/**
* 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.
*/
type ShouldSkipFunction = (props: ShouldSkipProps) => boolean;
/**
* An input rule which can have a `shouldSkip` property that returns true when
* the input rule should be skipped.
*/
type SkippableInputRule = ShouldSkip & InputRule;
interface NodeEqualsTypeProps extends NodeTypesProps, OptionalProsemirrorNodeProps {
}
/**
* Checks if the type a given `node` has a given `nodeType`.
*/
declare function isNodeOfType(props: NodeEqualsTypeProps): boolean;
interface MarkEqualsTypeProps extends MarkTypesProps, OptionalMarkProps {
}
/**
* Creates a new transaction object from a given transaction. This is useful
* when applying changes to a transaction, that you may want to rollback.
*
* ```ts
* 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.
*
* @param tr - the prosemirror transaction
*/
declare function cloneTransaction(tr: Transaction): Transaction;
interface ApplyClonedTransactionProps extends TransactionProps {
/**
* The clone.
*/
clone: Transaction;
}
/**
* Apply the steps of a cloned transaction to the original transaction `tr`.
*/
declare function applyClonedTransaction(props: ApplyClonedTransactionProps): void;
/**
* Returns a new transaction by combining all steps of the passed transactions onto the previous state
*/
declare function composeTransactionSteps(transactions: readonly Transaction[], oldState: EditorState$1): Transaction;
/**
* Checks if the type a given `node` has a given `nodeType`.
*/
declare function markEqualsType(props: MarkEqualsTypeProps): boolean;
interface RemoveNodeAtPositionProps extends TransactionProps, PosProps {
}
/**
* 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.
*
* @param position - the prosemirror position
*/
declare function removeNodeAtPosition({ pos, tr }: RemoveNodeAtPositionProps): Transaction;
interface ReplaceNodeAtPositionProps extends RemoveNodeAtPositionProps {
content: Fragment$1 | ProsemirrorNode | ProsemirrorNode[];
}
/**
* Replaces the node at the provided position with the provided content.
*/
declare function replaceNodeAtPosition({ pos, tr, content, }: ReplaceNodeAtPositionProps): Transaction;
/**
* Returns DOM reference of a node at a given `position`.
*
* @remarks
*
* If the node type is of type `TEXT_NODE` it will return the reference of the
* parent node.
*
* A simple use case
*
* ```ts
* const element = findElementAtPosition($from.pos, view);
* ```
*
* @param position - the prosemirror position
* @param view - the editor view
*/
declare function findElementAtPosition(position: number, view: EditorView): HTMLElement;
/**
* 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.
*
* ```ts
* const predicate = node => node.type === schema.nodes.blockquote;
* const parent = findParentNode({ predicate, selection });
* ```
*/
declare function findParentNode(props: FindParentNodeProps): FindProsemirrorNodeResult | undefined;
/**
* Finds the node at the resolved position.
*
* @param $pos - the resolve position in the document
*/
declare function findNodeAtPosition($pos: ResolvedPos$1): FindProsemirrorNodeResult;
/**
* Finds the node at the passed selection.
*/
declare function findNodeAtSelection(selection: Selection): FindProsemirrorNodeResult;
interface FindParentNodeOfTypeProps extends NodeTypesProps, StateSelectionPosProps {
}
/**
* 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});
* ```
*/
declare function findParentNodeOfType(props: FindParentNodeOfTypeProps): FindProsemirrorNodeResult | undefined;
/**
* Returns position of the previous node.
*
* ```ts
* const pos = findPositionOfNodeBefore(tr.selection);
* ```
*
* @param selection - the prosemirror selection
*
* @deprecated This util is hard to use and not that useful
*/
declare function findPositionOfNodeBefore(value: Selection | ResolvedPos$1 | EditorState$1 | Transaction): FindProsemirrorNodeResult | undefined;
/**
* Updates the provided transaction to remove the node before.
*
* ```ts
* dispatch(
* removeNodeBefore(state.tr)
* );
* ```
*
* @param tr
*
* @deprecated This util is hard to use and not that useful
*/
declare function removeNodeBefore(tr: Transaction): Transaction;
interface FindSelectedNodeOfTypeProps extends NodeTypesProps, SelectionProps {
}
/**
* 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.
*
* ```ts
* const { extension, inlineExtension, bodiedExtension } = schema.nodes;
*
* const selectedNode = findSelectedNodeOfType({
* types: [extension, inlineExtension, bodiedExtension],
* selection,
* });
* ```
*/
declare function findSelectedNodeOfType(props: FindSelectedNodeOfTypeProps): FindProsemirrorNodeResult | undefined;
interface FindProsemirrorNodeResult extends ProsemirrorNodeProps {
/**
* The start position of the node.
*/
start: number;
/**
* The end position of the node.
*/
end: number;
/**
* Points to position directly before the node.
*/
pos: number;
/**
* The depth the node. Equal to 0 if node is the root.
*/
depth: number;
}
interface StateSelectionPosProps {
/**
* Provide an editor state, or the editor selection or a resolved position.
*/
selection: EditorState$1 | Selection | ResolvedPos$1;
}
interface FindParentNodeProps extends StateSelectionPosProps {
predicate: (node: ProsemirrorNode, pos: number) => boolean;
}
/**
* Returns the position of the node after the current position, selection or
* state.
*
* ```ts
* const pos = findPositionOfNodeBefore(tr.selection);
* ```
*
* @param selection - the prosemirror selection
*
* @deprecated This util is hard to use and not that useful
*/
declare function findPositionOfNodeAfter(value: Selection | ResolvedPos$1 | EditorState$1): FindProsemirrorNodeResult | undefined;
/**
* Update the transaction to delete the node after the current selection.
*
* ```ts
* dispatch(removeNodeBefore(state.tr));
* ```
*
* @param tr
*
* @deprecated This util is hard to use and not that useful
*/
declare function removeNodeAfter(tr: Transaction): Transaction;
/**
* Checks whether the selection or state is currently empty.
*
* @param value - the transaction selection or state
*/
declare function isSelectionEmpty(value: Transaction | EditorState$1 | Selection): boolean;
/**
* Check to see if a transaction has changed either the document or the current
* selection.
*
* @param tr - the transaction to check
*/
declare function hasTransactionChanged(tr: Transaction): boolean;
/**
* 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.
*
* @param props - see [[`GetActiveAttrsProps`]]
*/
declare function isNodeActive(props: GetActiveAttrsProps): boolean;
interface GetActiveAttrsProps extends NodeTypeProps, Partial<AttributesProps> {
/**
* State or transaction parameter.
*/
state: EditorState$1 | Transaction;
}
/**
* 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.
*/
declare function getActiveNode(props: GetActiveAttrsProps): FindProsemirrorNodeResult | undefined;
/**
* The ProseMirror `Schema` as a JSON object.
*/
interface SchemaJSON<Nodes extends string = string, Marks extends string = string> {
/**
* The nodes of the schema.
*/
nodes: Record<Nodes, NodeSpec>;
/**
* The marks within the schema.
*/
marks: Record<Marks, MarkSpec>;
}
/**
* Converts a `schema` to a JSON compatible object.
*/
declare function schemaToJSON<Nodes extends string = string, Marks extends string = string>(schema: EditorSchema): SchemaJSON<Nodes, Marks>;
/**
* Chains together keybindings, allowing for the same key binding to be used
* across multiple extensions without overriding behavior.
*
* @remarks
*
* When `next` is called it hands over full control of the keybindings to the
* function that invokes it.
*/
declare function chainKeyBindingCommands(...commands: KeyBindingCommandFunction[]): KeyBindingCommandFunction;
/**
* 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.
*/
declare function mergeKeyBindings(extensionKeymaps: KeyBindings[]): KeyBindings;
/**
* 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.
*/
declare function mergeProsemirrorKeyBindings(extensionKeymaps: KeyBindings[]): ProsemirrorKeyBindings;
/**
* Determines if a Node or Mark contains the given attributes in its attributes set
*
* @param nodeOrMark - The Node or Mark to check
* @param attrs - The set of attributes it must contain
*/
declare function containsAttributes(nodeOrMark: ProsemirrorNode | Mark$1, attrs: ProsemirrorAttributes): boolean;
export { CreateDocumentNodeProps, CustomDocumentProps, DOM_SIZE_UNITS, DefaultDocNodeOptions, DomSizeUnit, FindProsemirrorNodeResult, FragmentStringHandlerOptions, GetMarkRange, InvalidContentBlock, InvalidContentHandler, InvalidContentHandlerProps, NamedStringHandlers, NodeStringHandlerOptions, NodeWithPosition, ParsedDomSize, RemoveMarkProps, ReplaceTextProps, SchemaJSON, ShouldSkipFunction, ShouldSkipProps, SkippableInputRule, StringHandler, StringHandlerOptions, StringHandlerProps, ToggleBlockItemProps, UpdateMarkProps, applyClonedTransaction, areSchemasCompatible, areStatesEqual, atDocEnd, atDocStart, canInsertNode, chainKeyBindingCommands, cloneTransaction, composeTransactionSteps, containsAttributes, containsNodesOfType, convertPixelsToDomUnit, createDocumentNode, endPositionOfParent, environment, extractPixelSize, findBlockNodes, findChildren, findChildrenByAttribute, findChildrenByMark, findChildrenByNode, findElementAtPosition, findInlineNodes, findNodeAtPosition, findNodeAtSelection, findParentNode, findParentNodeOfType, findPositionOfNodeAfter, findPositionOfNodeBefore, findSelectedNodeOfType, findTextNodes, getActiveNode, getChangedNodeRanges, getChangedNodes, getChangedRanges, getCursor, getDefaultBlockNode, getDefaultDocNode, getDocRange, getDocument, getFontSize, getInvalidContent, getMarkAttributes, getMarkRange, getMarkRanges, getMarkType, getMatchString, getNodeType, getRemirrorJSON, getSelectedGroup, getSelectedWord, getShortcutSymbols, getStyle, getTextContentFromSlice, getTextSelection, hasTransactionChanged, htmlToProsemirrorNode, isAllSelection, isChrome, isDefaultBlockNode, isDefaultDocNode, isDocNode, isDocNodeEmpty, isDomNode, isEditorSchema, isEditorState, isElementDomNode, isEmptyBlockNode, isEndOfTextBlock, isIdentifierOfType, isMarkActive, isMarkType, isNodeActive, isNodeOfType, isNodeSelection, isNodeType, isProsemirrorFragment, isProsemirrorMark, isProsemirrorNode, isRemirrorJSON, isRemirrorType, isResolvedPos, isSafari, isSelection, isSelectionEmpty, isStartOfDoc, isStartOfTextBlock, isTextDomNode, isTextSelection, isTransaction, joinStyles, lift, markEqualsType, markInputRule, mergeDOMRects, mergeKeyBindings, mergeProsemirrorKeyBindings, nodeInputRule, omitExtraAttributes, parseSizeUnit, plainInputRule, preserveSelection, prosemirrorNodeToDom, prosemirrorNodeToHtml, rangeHasMark, removeMark, removeNodeAfter, removeNodeAtPosition, removeNodeBefore, replaceNodeAtPosition, replaceText, schemaToJSON, setBlockType, setStyle, shouldUseDomEnvironment, startPositionOfParent, textBetween, toggleBlockItem, toggleWrap, updateMark, wrapIn };
export { updateMark } from './_tsup-dts-rollup';
export { lift } from './_tsup-dts-rollup';
export { wrapIn } from './_tsup-dts-rollup';
export { toggleWrap } from './_tsup-dts-rollup';
export { setBlockType } from './_tsup-dts-rollup';
export { toggleBlockItem } from './_tsup-dts-rollup';
export { isChrome } from './_tsup-dts-rollup';
export { isSafari } from './_tsup-dts-rollup';
export { preserveSelection } from './_tsup-dts-rollup';
export { replaceText } from './_tsup-dts-rollup';
export { removeMark } from './_tsup-dts-rollup';
export { UpdateMarkProps } from './_tsup-dts-rollup';
export { ToggleBlockItemProps } from './_tsup-dts-rollup';
export { ReplaceTextProps } from './_tsup-dts-rollup';
export { RemoveMarkProps } from './_tsup-dts-rollup';
export { isRemirrorType } from './_tsup-dts-rollup';
export { isIdentifierOfType } from './_tsup-dts-rollup';
export { isNodeType } from './_tsup-dts-rollup';
export { getNodeType } from './_tsup-dts-rollup';
export { isMarkType } from './_tsup-dts-rollup';
export { getMarkType } from './_tsup-dts-rollup';
export { isProsemirrorNode } from './_tsup-dts-rollup';
export { isProsemirrorFragment } from './_tsup-dts-rollup';
export { isProsemirrorMark } from './_tsup-dts-rollup';
export { isEditorState } from './_tsup-dts-rollup';
export { isTransaction } from './_tsup-dts-rollup';
export { isEditorSchema } from './_tsup-dts-rollup';
export { isTextSelection } from './_tsup-dts-rollup';
export { isAllSelection } from './_tsup-dts-rollup';
export { isSelection } from './_tsup-dts-rollup';
export { isResolvedPos } from './_tsup-dts-rollup';
export { rangeHasMark } from './_tsup-dts-rollup';
export { isNodeSelection } from './_tsup-dts-rollup';
export { isMarkActive } from './_tsup-dts-rollup';
export { canInsertNode } from './_tsup-dts-rollup';
export { isDocNodeEmpty } from './_tsup-dts-rollup';
export { isDefaultDocNode } from './_tsup-dts-rollup';
export { prosemirrorNodeEquals } from './_tsup-dts-rollup';
export { getDefaultDocNode } from './_tsup-dts-rollup';
export { getDefaultBlockNode } from './_tsup-dts-rollup';
export { isDefaultBlockNode } from './_tsup-dts-rollup';
export { isEmptyBlockNode } from './_tsup-dts-rollup';
export { getMarkAttributes } from './_tsup-dts-rollup';
export { getMarkRange } from './_tsup-dts-rollup';
export { getMarkRanges } from './_tsup-dts-rollup';
export { getChangedRanges } from './_tsup-dts-rollup';
export { getChangedNodeRanges } from './_tsup-dts-rollup';
export { getTextContentFromSlice } from './_tsup-dts-rollup';
export { getSelectedGroup } from './_tsup-dts-rollup';
export { getSelectedWord } from './_tsup-dts-rollup';
export { getMatchString } from './_tsup-dts-rollup';
export { atDocEnd } from './_tsup-dts-rollup';
export { atDocStart } from './_tsup-dts-rollup';
export { startPositionOfParent } from './_tsup-dts-rollup';
export { endPositionOfParent } from './_tsup-dts-rollup';
export { getCursor } from './_tsup-dts-rollup';
export { isDocNode } from './_tsup-dts-rollup';
export { isRemirrorJSON } from './_tsup-dts-rollup';
export { isAnchorHeadObject } from './_tsup-dts-rollup';
export { getTextSelection } from './_tsup-dts-rollup';
export { createDocumentNode } from './_tsup-dts-rollup';
export { shouldUseDomEnvironment } from './_tsup-dts-rollup';
export { getDocument } from './_tsup-dts-rollup';
export { maybeGetWindowFromDocument } from './_tsup-dts-rollup';
export { maybeGetWindowFromElement } from './_tsup-dts-rollup';
export { getWindowFromDocument } from './_tsup-dts-rollup';
export { getWindowFromElement } from './_tsup-dts-rollup';
export { prosemirrorNodeToDom } from './_tsup-dts-rollup';
export { prosemirrorNodeToHtml } from './_tsup-dts-rollup';
export { htmlToProsemirrorNode } from './_tsup-dts-rollup';
export { getRemirrorJSON } from './_tsup-dts-rollup';
export { areStatesEqual } from './_tsup-dts-rollup';
export { areSchemasCompatible } from './_tsup-dts-rollup';
export { omitExtraAttributes } from './_tsup-dts-rollup';
export { joinStyles } from './_tsup-dts-rollup';
export { textBetween } from './_tsup-dts-rollup';
export { getDocRange } from './_tsup-dts-rollup';
export { getInvalidContent } from './_tsup-dts-rollup';
export { isEndOfTextBlock } from './_tsup-dts-rollup';
export { isStartOfTextBlock } from './_tsup-dts-rollup';
export { isStartOfDoc } from './_tsup-dts-rollup';
export { DefaultDocNodeOptions } from './_tsup-dts-rollup';
export { GetMarkRange } from './_tsup-dts-rollup';
export { ChangedRange } from './_tsup-dts-rollup';
export { GetSelectedGroup } from './_tsup-dts-rollup';
export { NamedStringHandlers } from './_tsup-dts-rollup';
export { HandlersProps } from './_tsup-dts-rollup';
export { CreateDocumentNodeProps } from './_tsup-dts-rollup';
export { StringHandler } from './_tsup-dts-rollup';
export { StringHandlerProps } from './_tsup-dts-rollup';
export { CustomDocumentProps } from './_tsup-dts-rollup';
export { BaseStringHandlerOptions } from './_tsup-dts-rollup';
export { FragmentStringHandlerOptions } from './_tsup-dts-rollup';
export { NodeStringHandlerOptions } from './_tsup-dts-rollup';
export { StringHandlerOptions } from './_tsup-dts-rollup';
export { InvalidContentBlock } from './_tsup-dts-rollup';
export { InvalidContentHandlerProps } from './_tsup-dts-rollup';
export { InvalidContentHandler } from './_tsup-dts-rollup';
export { getStyle } from './_tsup-dts-rollup';
export { setStyle } from './_tsup-dts-rollup';
export { parseSizeUnit } from './_tsup-dts-rollup';
export { getFontSize } from './_tsup-dts-rollup';
export { extractPixelSize } from './_tsup-dts-rollup';
export { convertPixelsToDomUnit } from './_tsup-dts-rollup';
export { isDomNode } from './_tsup-dts-rollup';
export { isElementDomNode } from './_tsup-dts-rollup';
export { isTextDomNode } from './_tsup-dts-rollup';
export { mergeDOMRects } from './_tsup-dts-rollup';
export { DOM_SIZE_UNITS } from './_tsup-dts-rollup';
export { DomSizeUnit } from './_tsup-dts-rollup';
export { ParsedDomSize } from './_tsup-dts-rollup';
export { environment } from './_tsup-dts-rollup';
export { NodeWithPosition } from './_tsup-dts-rollup';
export { containsNodesOfType } from './_tsup-dts-rollup';
export { findBlockNodes } from './_tsup-dts-rollup';
export { findChildren } from './_tsup-dts-rollup';
export { findChildrenByAttribute } from './_tsup-dts-rollup';
export { findChildrenByMark } from './_tsup-dts-rollup';
export { findChildrenByNode } from './_tsup-dts-rollup';
export { findInlineNodes } from './_tsup-dts-rollup';
export { findTextNodes } from './_tsup-dts-rollup';
export { getChangedNodes } from './_tsup-dts-rollup';
export { ShouldSkipFunction } from './_tsup-dts-rollup';
export { ShouldSkipProps } from './_tsup-dts-rollup';
export { SkippableInputRule } from './_tsup-dts-rollup';
export { markInputRule } from './_tsup-dts-rollup';
export { nodeInputRule } from './_tsup-dts-rollup';
export { plainInputRule } from './_tsup-dts-rollup';
export { FindProsemirrorNodeResult } from './_tsup-dts-rollup';
export { SchemaJSON } from './_tsup-dts-rollup';
export { applyClonedTransaction } from './_tsup-dts-rollup';
export { chainKeyBindingCommands } from './_tsup-dts-rollup';
export { cloneTransaction } from './_tsup-dts-rollup';
export { composeTransactionSteps } from './_tsup-dts-rollup';
export { containsAttributes } from './_tsup-dts-rollup';
export { findElementAtPosition } from './_tsup-dts-rollup';
export { findNodeAtPosition } from './_tsup-dts-rollup';
export { findNodeAtSelection } from './_tsup-dts-rollup';
export { findParentNode } from './_tsup-dts-rollup';
export { findParentNodeOfType } from './_tsup-dts-rollup';
export { findPositionOfNodeAfter } from './_tsup-dts-rollup';
export { findPositionOfNodeBefore } from './_tsup-dts-rollup';
export { findSelectedNodeOfType } from './_tsup-dts-rollup';
export { getActiveNode } from './_tsup-dts-rollup';
export { hasTransactionChanged } from './_tsup-dts-rollup';
export { isNodeActive } from './_tsup-dts-rollup';
export { isNodeOfType } from './_tsup-dts-rollup';
export { isSelectionEmpty } from './_tsup-dts-rollup';
export { markEqualsType } from './_tsup-dts-rollup';
export { mergeKeyBindings } from './_tsup-dts-rollup';
export { mergeProsemirrorKeyBindings } from './_tsup-dts-rollup';
export { removeNodeAfter } from './_tsup-dts-rollup';
export { removeNodeAtPosition } from './_tsup-dts-rollup';
export { removeNodeBefore } from './_tsup-dts-rollup';
export { replaceNodeAtPosition } from './_tsup-dts-rollup';
export { schemaToJSON } from './_tsup-dts-rollup';
export { chainableEditorState } from './_tsup-dts-rollup';
export { chainCommands } from './_tsup-dts-rollup';
export { convertCommand } from './_tsup-dts-rollup';
export { nonChainable } from './_tsup-dts-rollup';
export { getShortcutSymbols } from './_tsup-dts-rollup';
export { BeforeDispatchProps } from './_tsup-dts-rollup';
export { BaseInputRuleProps } from './_tsup-dts-rollup';
export { NodeInputRuleProps } from './_tsup-dts-rollup';
export { PlainInputRuleProps } from './_tsup-dts-rollup';
export { UpdateCaptureTextProps } from './_tsup-dts-rollup';
{
"name": "@remirror/core-utils",
"version": "2.0.13",
"version": "3.0.0-beta.0",
"description": "Core utilities for dealing with the dom and prosemirror within remirror",

@@ -34,6 +34,6 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/remirror__core-utils",

"@babel/runtime": "^7.22.3",
"@remirror/core-constants": "^2.0.2",
"@remirror/core-helpers": "^3.0.0",
"@remirror/core-types": "^2.0.5",
"@remirror/messages": "^2.0.6",
"@remirror/core-constants": "3.0.0-beta.0",
"@remirror/core-helpers": "4.0.0-beta.0",
"@remirror/core-types": "3.0.0-beta.0",
"@remirror/messages": "3.0.0-beta.0",
"@types/min-document": "^2.19.0",

@@ -46,3 +46,4 @@ "css-in-js-utils": "^3.1.0",

"devDependencies": {
"@remirror/pm": "^2.0.7",
"@remirror/cli": "1.0.1",
"@remirror/pm": "3.0.0-beta.0",
"@types/jsdom": "^16.2.15",

@@ -53,3 +54,3 @@ "@types/node": "^16.18.34",

"peerDependencies": {
"@remirror/pm": "^2.0.7",
"@remirror/pm": "^3.0.0-beta.0",
"@types/node": "*"

@@ -67,3 +68,6 @@ },

"sizeLimit": "25 KB"
},
"scripts": {
"build": "remirror-cli build"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc