@point-api/dropdown-react
Version:
HOC to add a Point API autocomplete dropdown
28 lines (27 loc) • 1.19 kB
TypeScript
import EditableAdapter from "./EditableAdapter";
/** Adapter class for a ContentEditable div */
declare class ContentEditableAdapter implements EditableAdapter {
readonly el: HTMLDivElement;
private readonly usesReact;
private readonly supportsRichText;
private readonly supportsAutoInsert;
/**
* Expose EditableAdapter API functions for a ContentEditable div
* @param el - ContentEditable div element to wrap
*/
constructor(el: HTMLDivElement, usesReact?: boolean, supportsRichText?: boolean, supportsAutoInsert?: boolean);
/** @note Gets text of the current line a user's caret is in, not the whole ContentEditable */
readonly text: string;
private variableReplacer;
private setCursorToEndOfSelectionStart;
insertText(text: string, cursorIndex?: number, node?: any): void;
private stripRichText;
replaceText(match: RegExpExecArray, text: string): void;
/** @note Gets cursor index of the current line a user's caret is in, not the whole ContentEditable */
getCursorIndex(): number | null;
getCaretPos(): {
left: number;
top: number;
} | null;
}
export default ContentEditableAdapter;