extension-count
package @remirror/extension-count
class CountExtension
Count words or characters in your editor, and set a soft max length
Signature:
export declare class CountExtension extends PlainExtension<CountOptions>
Extends: PlainExtension<CountOptions>
(Some inherited members may not be shown because they are not represented in the documentation.)
property name
Signature:
get name(): "count";
method createDecorationSet
Signature:
protected createDecorationSet(state: EditorState): DecorationSet;
Parameters:
Parameter | Type | Description |
---|---|---|
state | EditorState |
Returns:
DecorationSet
method createExternalPlugins
Signature:
createExternalPlugins(): Plugin[];
Returns:
Plugin[]
method getCharacterCount
Get the count of characters in the document.
Signature:
getCharacterCount(state?: EditorState): Helper<number>;
Parameters:
Parameter | Type | Description |
---|---|---|
state | EditorState | (Optional) |
Returns:
Helper<number>
method getCountMaximum
Get the configured maximum characters/words.
Signature:
getCountMaximum(): Helper<number>;
Returns:
Helper<number>
method getWordCount
Get the count of words in the document.
Signature:
getWordCount(state?: EditorState): Helper<number>;
Parameters:
Parameter | Type | Description |
---|---|---|
state | EditorState | (Optional) |
Returns:
Helper<number>
method isCountValid
Is the current number of characters/words valid in the current strategy.
Signature:
isCountValid(state?: EditorState): Helper<boolean>;
Parameters:
Parameter | Type | Description |
---|---|---|
state | EditorState | (Optional) |
Returns:
Helper<boolean>
enum CountStrategy
Signature:
export declare enum CountStrategy
Enumeration Members:
Member | Value | Description |
---|---|---|
CHARACTERS | "CHARACTERS" | |
WORDS | "WORDS" |
interface CountOptions
Signature:
export interface CountOptions
property maximum
An optional soft limit. Text that exceeds this limit will be highlighted.
Signature:
maximum?: Static<number>;
property maximumExceededClassName
The classname to use when highlighting text that exceed the given maximum.
Signature:
maximumExceededClassName?: Static<string>;
property maximumStrategy
The counting strategy to use. Either CountStrategy.CHARACTERS or CountStrategy.WORDS
Signature:
maximumStrategy?: Static<CountStrategy>;