medium-proeditor
Version:
A powerful & customizable Medium-style rich text editor
37 lines • 1.2 kB
TypeScript
import { type EditorState, Plugin } from 'prosemirror-state';
import type { Editor } from './Editor';
import type { Commands, ExtendedRegExpMatchArray, Range } from './types';
export type PasteRuleMatch = {
index: number;
text: string;
replaceWith?: string;
match?: RegExpMatchArray;
data?: Record<string, any>;
};
export type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
export declare class PasteRule {
find: PasteRuleFinder;
handler: (props: {
state: EditorState;
range: Range;
match: ExtendedRegExpMatchArray;
commands: Commands;
pasteEvent: ClipboardEvent | null;
}) => void;
constructor(config: {
find: PasteRuleFinder;
handler: (props: {
state: EditorState;
range: Range;
match: ExtendedRegExpMatchArray;
commands: Commands;
pasteEvent: ClipboardEvent | null;
}) => void;
});
}
export declare function pasteRulesPlugin({ rules, commands, }: {
editor: Editor;
commands: Commands;
rules: PasteRule[];
}): Plugin;
//# sourceMappingURL=PasteRule.d.ts.map