5bb4c43ca78a144f68967c5c410c4a604c453d36a2794c6edf0e0580c97412e788b5681c930f3b22ea79fc48b2f94b7431febb48e117ad86a1bbd6337214a1 1.0 KB

123456789101112131415161718192021222324
  1. import Quill from '../core/quill.js';
  2. import Module from '../core/module.js';
  3. import type { Range } from '../core/selection.js';
  4. type Handler = (this: Toolbar, value: any) => void;
  5. export type ToolbarConfig = Array<string[] | Array<string | Record<string, unknown>>>;
  6. export interface ToolbarProps {
  7. container?: HTMLElement | ToolbarConfig | null;
  8. handlers?: Record<string, Handler>;
  9. option?: number;
  10. module?: boolean;
  11. theme?: boolean;
  12. }
  13. declare class Toolbar extends Module<ToolbarProps> {
  14. static DEFAULTS: ToolbarProps;
  15. container?: HTMLElement | null;
  16. controls: [string, HTMLElement][];
  17. handlers: Record<string, Handler>;
  18. constructor(quill: Quill, options: Partial<ToolbarProps>);
  19. addHandler(format: string, handler: Handler): void;
  20. attach(input: HTMLElement): void;
  21. update(range: Range | null): void;
  22. }
  23. declare function addControls(container: HTMLElement, groups: (string | Record<string, unknown>)[][] | (string | Record<string, unknown>)[]): void;
  24. export { Toolbar as default, addControls };