[@types/slate] Support nested plugin stacks on the "plugins" c… (#36349)

* 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
This commit is contained in:
Lukas Bünger
2019-06-24 12:55:21 -07:00
committed by Daniel Rosenwasser
parent 64175d87d6
commit 92c707eed0
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -1131,9 +1131,11 @@ export interface Plugin {
schema?: SchemaProperties;
}
export interface Plugins extends Array<Plugin | Plugins> {}
export interface EditorProperties {
onChange?: (change: { operations: Immutable.List<Operation>, value: Value }) => void;
plugins?: Plugin[];
onChange?: (change: { operations: Immutable.List<Operation>; value: Value }) => void;
plugins?: Plugins;
readOnly?: boolean;
value?: Value;
}
+1 -1
View File
@@ -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 });