slate-devtools
Version:
`slate-devtools` as name suggests it is devtool for [slatejs](https://github.com/ianstormtaylor/slate) which will assist you in debugging the code
56 lines • 2.02 kB
TypeScript
import { Operation } from "slate";
import { ReactEditor } from "slate-react";
import { Batch } from "./batch";
import { DTOperation } from "./DTOperation";
export declare type runOptions = {
shouldNormalize?: boolean;
location?: "App" | "Devtools";
};
export declare type HistoryEditor = {
history: Batch[];
isNormalizing: boolean;
shouldSave: boolean;
shouldNormalize: boolean;
apply: (op: Operation, options: runOptions) => void;
from: [number, number] | undefined;
dontMerge: boolean;
};
declare type Location = [number, number];
declare type HistoryOptions = {
from: Location;
to: Location;
mode?: "top-bottom" | "bottom-top" | "auto";
considerFrom?: boolean;
considerTo?: boolean;
};
export declare const HistoryEditor: {
/**
* Calls an function without saving any of the operations applied because
* of that function to history
*/
withoutSave(editor: HistoryEditor, callback: () => unknown): void;
/**
* Retuns an generator of Opeartions
*/
operations(editor: HistoryEditor, options: HistoryOptions): Generator<DTOperation<Operation>, void, unknown>;
/**
* Generator yields inverse of operations based on options
*/
inverseOperations(editor: HistoryEditor, options: HistoryOptions): Generator<DTOperation<Operation>, void, unknown>;
/**
* Applies operations to the given editor. The function will take care if we should
* apply the inverse of the operations or not
*/
apply(editor: HistoryEditor & ReactEditor, from: [number, number], to: [number, number]): void;
/**
* Given an HistoryEditor and `till` the function will return
* operations till `till`
*/
giveTill(editor: HistoryEditor, till: [number, number]): Batch[];
/**
* Checks if the editor is HistoryEditor
*/
isHistoryEditor(editor: any): editor is HistoryEditor;
};
export {};
//# sourceMappingURL=historyEditor.d.ts.map