Skip to main content

extension-find

package @remirror/extension-find

class FindExtension

This extension add find and replace functionality to your editor.

Signature:

export declare class FindExtension extends PlainExtension<FindOptions> 

Extends: PlainExtension<FindOptions>

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

property name

Signature:

get name(): "find";

method createPlugin

This plugin is responsible for do the searching and updating the decorations.

Signature:

createPlugin(): CreateExtensionPlugin;

Returns:

CreateExtensionPlugin

method find

Find and highlight the search result in the editor.

Signature:

find({ query, activeIndex, caseSensitive }: FindProps): CommandFunction;

Parameters:

ParameterTypeDescription
{ query, activeIndex, caseSensitive }FindProps

Returns:

CommandFunction

method findAndReplace

Find and replace one search result.

Signature:

findAndReplace({ query, caseSensitive, replacement, index, }: FindAndReplaceProps): CommandFunction;

Parameters:

ParameterTypeDescription
{ query, caseSensitive, replacement, index, }FindAndReplaceProps

Returns:

CommandFunction

method findAndReplaceAll

Find and replace all search results.

Signature:

findAndReplaceAll({ query, caseSensitive, replacement, }: FindAndReplaceAllProps): CommandFunction;

Parameters:

ParameterTypeDescription
{ query, caseSensitive, replacement, }FindAndReplaceAllProps

Returns:

CommandFunction

method findRanges

Find and highlight the search result in the editor. Returns search results.

Signature:

findRanges(options: FindProps): Helper<FindResult>;

Parameters:

ParameterTypeDescription
optionsFindProps

Returns:

Helper<FindResult>

method stopFind

Stop find and remove all highlight.

Signature:

stopFind(): CommandFunction;

Returns:

CommandFunction

interface FindAndReplaceAllProps

Signature:

export interface FindAndReplaceAllProps 

property caseSensitive

Signature:

caseSensitive?: boolean;

property query

The text to search for.

Signature:

query: string;

property replacement

The text to replace.

Signature:

replacement: string;

interface FindAndReplaceProps

Signature:

export interface FindAndReplaceProps 

property caseSensitive

Signature:

caseSensitive?: boolean;

property index

The index of search result to highlight. If not provided, the active one will be replace.

Signature:

index?: number;

property query

The text to search for.

Signature:

query: string;

property replacement

The text to replace.

Signature:

replacement: string;

interface FindOptions

Signature:

export interface FindOptions 

property activeDecoration

The inline decoraton to apply to the active search result (if any).

Signature:

activeDecoration?: DecorationAttrs;

property alwaysFind

When the search is active, whether to do a search on every document change.

Signature:

alwaysFind?: boolean;

property decoration

The inline decoraton to apply to all search results.

Signature:

decoration?: DecorationAttrs;

interface FindProps

Signature:

export interface FindProps 

property activeIndex

The index of search result to highlight. If not provided, none will be highlighted.

Signature:

activeIndex?: number;

property caseSensitive

Signature:

caseSensitive?: boolean;

property query

The text to search for.

Signature:

query: string;

interface FindResult

Signature:

export interface FindResult 

property activeIndex

The index of search result to highlight. Undefined if no search result is active.

Signature:

activeIndex: number | undefined;

property ranges

The absolute position ranges of all search result.

Signature:

ranges: FromToProps[];