InputRule
Type Stability: stable
A declarative text-replacement rule applied while typing: when the text before the caret matches pattern, handler runs
(the markdown shortcuts and the typography substitutions are input rules).
Definition
TypeScript
import type { InputRule } from '@aionbuilders/nabu/extend';TypeScript
interface InputRule {
handler: (nabu: Nabu, block: Block, match: RegExpMatchArray, sel: {
data: string;
from: number;
isCollapsed: boolean;
to: number;
}) => boolean | void;
inputType?: string;
pattern: RegExp;
}Properties
| Property | Type | Description |
|---|---|---|
handler | (nabu: Nabu, block: Block, match: RegExpMatchArray, sel: {
data: string;
from: number;
isCollapsed: boolean;
to: number;
}) => boolean | void |
|
inputTypeoptional | string | Défaut: "insertText" |
pattern | RegExp | Testé sur le texte AVANT le curseur (avec l'inputType "insertText") |
Source: src/lib/utils/extensions.js:122