Merge pull request #30053 from sgreav/master

[Slate] Correct definition for KeyUtils
This commit is contained in:
Ron Buckton
2018-10-26 18:31:26 -07:00
committed by GitHub
2 changed files with 10 additions and 6 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for slate 0.42
// Type definitions for slate 0.43
// Project: https://github.com/ianstormtaylor/slate
// Definitions by: Andy Kent <https://github.com/andykent>
// Jamie Talbot <https://github.com/majelbstoat>
@@ -1478,10 +1478,10 @@ export class SlateError extends Error {
[key: string]: any;
}
export interface KeyUtils {
create(key: string): string;
setGenerator(func: () => any): void;
resetGenerator(): void;
export namespace KeyUtils {
function create(key?: string): string;
function setGenerator(func: () => any): void;
function resetGenerator(): void;
}
export type useMemoization = () => void;
+5 -1
View File
@@ -1,4 +1,4 @@
import { Value, Data, BlockJSON, Document, Editor, Change } from "slate";
import { Value, Data, BlockJSON, Document, Editor, Change, KeyUtils } from "slate";
const data = Data.create({ foo: "bar " });
const value = Value.create({ data });
@@ -58,3 +58,7 @@ editor.command("testCommand");
editor.query("testQuery");
editor.run("testCommand");
editor.event("mouseDown", new Event("mouseDown"));
KeyUtils.setGenerator(() => "Test");
KeyUtils.create();
KeyUtils.resetGenerator();