From 92c707eed00fa822e069ccfb34b9911f42c86733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20B=C3=BCnger?= Date: Mon, 24 Jun 2019 21:55:21 +0200 Subject: [PATCH] =?UTF-8?q?[@types/slate]=20Support=20nested=20plugin=20st?= =?UTF-8?q?acks=20on=20the=20"plugins"=20c=E2=80=A6=20(#36349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: editor takes a recursively nested plugin stack as contructor argument * chore: formatting * refactor: remove obsolete list type. naming * fix: enforce a list as root data type. * Update index.d.ts --- types/slate/index.d.ts | 6 ++++-- types/slate/slate-tests.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index 18664c54d2..58d92dd7ab 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -1131,9 +1131,11 @@ export interface Plugin { schema?: SchemaProperties; } +export interface Plugins extends Array {} + export interface EditorProperties { - onChange?: (change: { operations: Immutable.List, value: Value }) => void; - plugins?: Plugin[]; + onChange?: (change: { operations: Immutable.List; value: Value }) => void; + plugins?: Plugins; readOnly?: boolean; value?: Value; } diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 2c243136fe..77cc12ac8d 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -114,7 +114,7 @@ const plugin: Plugin = { schema: {...schema}, }; -const plugins = [plugin]; +const plugins = [plugin, [plugin, [plugin]]]; const editor = new Editor({ value, plugins }); const point = Point.create({ key: "a", offset: 0 });