045d49ca3205bd66222d000742ec3836297d5609cc436ad34d920f819f4f7c5c29e966fe7b639ba0cc2569aea69a4d1108cab99edb8b79549df97c20fca257 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { AttributorStore, BlockBlot, EmbedBlot } from 'parchment';
  2. import type { Blot, Parent } from 'parchment';
  3. import Delta from 'quill-delta';
  4. declare class Block extends BlockBlot {
  5. cache: {
  6. delta?: Delta | null;
  7. length?: number;
  8. };
  9. delta(): Delta;
  10. deleteAt(index: number, length: number): void;
  11. formatAt(index: number, length: number, name: string, value: unknown): void;
  12. insertAt(index: number, value: string, def?: unknown): void;
  13. insertBefore(blot: Blot, ref?: Blot | null): void;
  14. length(): number;
  15. moveChildren(target: Parent, ref?: Blot | null): void;
  16. optimize(context: {
  17. [key: string]: any;
  18. }): void;
  19. path(index: number): [Blot, number][];
  20. removeChild(child: Blot): void;
  21. split(index: number, force?: boolean | undefined): Blot | null;
  22. }
  23. declare class BlockEmbed extends EmbedBlot {
  24. attributes: AttributorStore;
  25. domNode: HTMLElement;
  26. attach(): void;
  27. delta(): Delta;
  28. format(name: string, value: unknown): void;
  29. formatAt(index: number, length: number, name: string, value: unknown): void;
  30. insertAt(index: number, value: string, def?: unknown): void;
  31. }
  32. declare function blockDelta(blot: BlockBlot, filter?: boolean): Delta;
  33. declare function bubbleFormats(blot: Blot | null, formats?: Record<string, unknown>, filter?: boolean): Record<string, unknown>;
  34. export { blockDelta, bubbleFormats, BlockEmbed, Block as default };