UNPKG

textchecker-element

Version:
61 lines (60 loc) 1.45 kB
import type { TextlintMessage, TextlintResult } from "@textlint/types"; /** * Lint Server API */ export type LintEngineAPI = { lintText({ text }: { text: string; }): Promise<TextlintResult[]>; fixText({ text, messages }: { text: string; messages: TextlintMessage[]; }): Promise<{ output: string; }>; ignoreText({ text, message }: { text: string; message: TextlintMessage; }): Promise<boolean>; mergeConfig?({ textlintrc }: { textlintrc: string; }): Promise<void>; }; export type AttachTextAreaParams = { /** * target textarea element */ textAreaElement: HTMLTextAreaElement; /** * linting debounce timeout millisecond * default: 200ms */ lintingDebounceMs: number; lintEngine: LintEngineAPI; }; /** * Dismiss all popup * * - Update text(includes fixed) * - Scroll textarea/Scroll window * - Focus on textarea * - Click out of textarea/popup * - popup → textarea → other → dismiss * - textarea → popup → other → dismiss */ /** * Dismiss a single popup(500ms delay) * * - Leave from popup * - Leave from RectItem * - Focus on textarea * */ /** * Show popup condition * - onUpdate */ /** * Attach text-checker component to `<textarea>` element */ export declare const attachToTextArea: ({ textAreaElement, lintingDebounceMs, lintEngine }: AttachTextAreaParams) => (() => void);