742d2dd9d7adb4a07f52c7ae69798d0de6ea504cb443a40b55f37eb7ff82c9630e3222b6088f57876a45f4d579ce26736c00207df56ecc143ac10119fa9794 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import type Delta from 'quill-delta';
  2. import Module from '../core/module.js';
  3. import Quill from '../core/quill.js';
  4. import type Scroll from '../blots/scroll.js';
  5. import type { Range } from '../core/selection.js';
  6. export interface HistoryOptions {
  7. userOnly: boolean;
  8. delay: number;
  9. maxStack: number;
  10. }
  11. export interface StackItem {
  12. delta: Delta;
  13. range: Range | null;
  14. }
  15. interface Stack {
  16. undo: StackItem[];
  17. redo: StackItem[];
  18. }
  19. declare class History extends Module<HistoryOptions> {
  20. static DEFAULTS: HistoryOptions;
  21. lastRecorded: number;
  22. ignoreChange: boolean;
  23. stack: Stack;
  24. currentRange: Range | null;
  25. constructor(quill: Quill, options: Partial<HistoryOptions>);
  26. change(source: 'undo' | 'redo', dest: 'redo' | 'undo'): void;
  27. clear(): void;
  28. cutoff(): void;
  29. record(changeDelta: Delta, oldDelta: Delta): void;
  30. redo(): void;
  31. transform(delta: Delta): void;
  32. undo(): void;
  33. protected restoreSelection(stackItem: StackItem): void;
  34. }
  35. declare function getLastChangeIndex(scroll: Scroll, delta: Delta): number;
  36. export { History as default, getLastChangeIndex };