@taze-editor/taze-core
Version:
Taze Editor's core package - makes easier to create rich text editor
25 lines • 1.22 kB
TypeScript
import { TEditor, Value } from "../slate/editor/TEditor";
import { ENode, TNode } from "../slate/node/TNode";
import { TPath } from "../slate/types/interfaces";
export type PredicateObj = Record<string, any | any[]>;
export type PredicateFn<T extends TNode> = (obj: T, path: TPath) => boolean;
export type Predicate<T extends TNode> = PredicateObj | PredicateFn<T>;
/**
* Match the object with a predicate object or function.
* If predicate is:
* - object: every predicate key/value should be in obj.
* - function: it should return true.
*/
export declare const match: <T extends TNode>(obj: T, path: import("slate").Path, predicate?: Predicate<T> | undefined) => boolean;
/**
* Extended query options for slate queries:
* - `match` can be an object predicate where one of the values should include the node value.
* Example: { type: ['1', '2'] } will match the nodes having one of these 2 types.
*/
export declare const getQueryOptions: <V extends Value>(editor: TEditor<V>, options?: any) => any;
export type ENodeMatch<N extends TNode> = Predicate<N>;
export interface ENodeMatchOptions<V extends Value = Value> {
match?: ENodeMatch<ENode<V>>;
block?: boolean;
}
//# sourceMappingURL=match.d.ts.map