history-editor.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { BaseEditor } from 'slate';
  2. import { History } from './history';
  3. /**
  4. * Weakmaps for attaching state to the editor.
  5. */
  6. export declare const HISTORY: WeakMap<BaseEditor, History>;
  7. export declare const SAVING: WeakMap<BaseEditor, boolean | undefined>;
  8. export declare const MERGING: WeakMap<BaseEditor, boolean | undefined>;
  9. /**
  10. * `HistoryEditor` contains helpers for history-enabled editors.
  11. */
  12. export interface HistoryEditor extends BaseEditor {
  13. history: History;
  14. undo: () => void;
  15. redo: () => void;
  16. }
  17. export declare const HistoryEditor: {
  18. /**
  19. * Check if a value is a `HistoryEditor` object.
  20. */
  21. isHistoryEditor(value: any): value is HistoryEditor;
  22. /**
  23. * Get the merge flag's current value.
  24. */
  25. isMerging(editor: HistoryEditor): boolean | undefined;
  26. /**
  27. * Get the saving flag's current value.
  28. */
  29. isSaving(editor: HistoryEditor): boolean | undefined;
  30. /**
  31. * Redo to the previous saved state.
  32. */
  33. redo(editor: HistoryEditor): void;
  34. /**
  35. * Undo to the previous saved state.
  36. */
  37. undo(editor: HistoryEditor): void;
  38. /**
  39. * Apply a series of changes inside a synchronous `fn`, without merging any of
  40. * the new operations into previous save point in the history.
  41. */
  42. withoutMerging(editor: HistoryEditor, fn: () => void): void;
  43. /**
  44. * Apply a series of changes inside a synchronous `fn`, without saving any of
  45. * their operations into the history.
  46. */
  47. withoutSaving(editor: HistoryEditor, fn: () => void): void;
  48. };
  49. //# sourceMappingURL=history-editor.d.ts.map