editify
Version:
A pure implementation of WYSIWYG HTML editor all we needed
21 lines (20 loc) • 592 B
TypeScript
export declare type EditorEvent = 'change' | 'selectionchange';
export interface CurrentState {
element: HTMLElement | null;
style: {
bold: boolean;
};
}
export declare class Editify {
private readonly editor;
private readonly toolbarBold;
private readonly currentState;
constructor(id: string);
on: (event: EditorEvent, fn: (...args: any) => void) => void;
off: (event: EditorEvent, fn: (...args: any) => void) => void;
private onKeyUp;
private onSelectStart;
private onMouseUp;
private getCaretPosition;
private toggleBold;
}